5
голосов
1ответов
5024 просмотров

calling function based on dom change

I rewrote a bit of my code based on that it's not really feasible to check to see if a javascript variable changes. But, how would I do it with a dom element? For instance <div id='foo'>123</div> <script> $('#foo').html('456'); // function gets fired since #foo changed. </sc...

1
голосов
1ответов
1372 просмотров

onchange event doesn't bubble in MSIE. Where do I find a chart listing all such events

I just found out that onchange event does not bubble in MSIE. I hopped to http://www.quirksmode.org/ to see if I could find other events which are not supported by IE. However I do not see any chart listing onchange event as an event that does not bubble in MSIE. Where can I find such a char?

2
голосов
3ответов
3680 просмотров

Jquery unwrap() method?

There is a great method in jquery called wrap() that will wrap a selected element inside a new element, like so: Start with: <p>I wish I was wrapped!</p> Add code: $("p").wrap("<div></div>"); End with: <div><p>I wish I was wrapped!</p></div&g...

164
голосов
4ответов
136687 просмотров

How to use "not" in xpath?

I want to write something of the sort: //a[not contains(@id, 'xx')] (meaning all the links that there 'id' attribute doesn't contain the string 'xx') I can't find the right syntax.

1
голосов
1ответов
2140 просмотров

Cross window js interaction between a popup and another window of the same domain

I'm trying to open a popup from window a at example.com. then close window a and open another window b at the same domain (example.com). Is it possible to access the DOM of window a from window b and how? The popup is opened from window a by window.open('http://example.com/blah', 'somename', se...

0
голосов
2ответов
234 просмотров

What are the issue with putting markup outside ?

I have a bookmarklet storing a lot of DOM data, but I would love to avoid to put them out of the body tag so the script in the page won't mess with it. Semantic value is not an issue for once, but I would like to know : will it trigger some browser behaviour ? will it still be accessible in th...

1
голосов
1ответов
158 просмотров

creating an element and setting its attribute with jQuery

I'm trying to create an <ol> element with jQuery and set its class and id attributes. Is there any way to do this all at once? None of my ideas have worked so far, I'm still very new to jQuery...

1
голосов
1ответов
1347 просмотров

Detect for website change via javascript / jquery

Is it possible to check if the browser user has opened a new tab, is closing (not minimizing) the current tab/page, or changing the url? Don't worry, nothing suss it's just for a novelty website. Could someone let me know if this is/isn't feasible via javascript (preferably jquery), and if so, wh...

1
голосов
2ответов
4305 просмотров

How to get nodes in first level using PHP DOMDocument?

I'm new to PHP DOM object and have a problem I can't find a solution. I have a DOMDocument with following HTML: <div id="header"> </div> <div id="content"> <div id="sidebar"> </div> <div id="info"> </div> </div> <div id="footer"&...

0
голосов
2ответов
255 просмотров

using getElementById to retrieve styless in CSS

Why is the first alert box empty, but the second one says 100px? I'd expect the first box to say 300px.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> ...

1
голосов
1ответов
5080 просмотров

jQuery hover over child elements makes quirky effects

I've got this markup (simplified): <div class='item'> <a> one link </a> <a class='trash'><img src='trash.png'/></a> </div> I'm highlighting the div when the mouse enters, and showing the (otherwise hidden) 'trash' link (it's like a tiny trash bin) ...

0
голосов
1ответов
226 просмотров

Why does jQuery's $().each() function seem to be losing track of the DOM?

I've recently started encountering a very strange problem. To be honest, I'm not entirely sure how to describe it other than to just show it. Here's the relevant HTML: <div class="component container w100 noEdit" id="contentWrapper"> <div class="component container w50" id="container...

0
голосов
1ответов
96 просмотров

Replacing a Classed Element's Content (without an ID)

So I've managed to get stuck using Prototype for a Project, and so far I can't stand it. All I want to do, is replace a title within a very specific place - it has no ID and I can't change the HTML, since it's not hosted by me. Event.observe(window, 'load', function() { $$('#page #containe...

8
голосов
6ответов
6733 просмотров

How to avoid DOM parsing adding html doctype, and tags?

<? $string = ' Some photos<br> <span class="naslov_slike">photo_by_ile_IMG_1676-01</span><br /> <span class="naslov_slike">photo_by_ile_IMG_1699-01</span><br /> <span class="naslov_slike">photo_by_ile_IMG_1697-01</span>&...

0
голосов
1ответов
354 просмотров

Programmatically determine the DOM element to add the 'scroll' listener to

I'm writing a Firefox add-on and most of the time using document.addEventListener("scroll", scrollListener, false); works just fine. However on cuil.com that doesn't work. Basically any site that has a fixed header or footer that doesn't scroll causes a problem with the above code. How do I d...

22
голосов
3ответов
32939 просмотров

Find child by index jQuery

jQuery can return last or first child,it works ok. But I need to get second child. This construction (get child by index) doesn't work,when get its text: child.parent().parent().children().get(1).text() So, how can i find non-last and non-first child (e.g. second)?

1
голосов
2ответов
1938 просмотров

RowIndex in Javascript

I currently have a big problem with the rowIndex in the IE8. When I call the page I have an empty table element. With Javascript I now add Rows and Columns to this table. // Create Elements tr = document.createElement('tr'); td = document.createElement('td'); // Append Elements to existing Table...

2
голосов
1ответов
602 просмотров

Stuck with Simple Html Dom and extracting information

I'm trying to use simple html DOM to extract everything inside a tag with the class "sitepoint". Here is my code that doesn't work: <?php include_once('simple_html_dom.php'); $html = file_get_html('examplewebsite'); $ret = $html->find('.sitepoint'); echo $ret; ?> Below is an example...

6
голосов
3ответов
8733 просмотров

How to find actual rendered values of elements set to 'auto' using JavaScript

Suppose I have the following html, and no CSS <div> here is some content in this div. it stretches it out <br />and down too! </div> Now I want to get the actual pixel width and height that the browser has rendered this div as. Can that be done with JS? Thank you.

0
голосов
3ответов
977 просмотров

Why does php DOM parsing affect charset?

$dom = new DOMDocument(); $dom->loadHTML($string); $dom->preserveWhiteSpace = false; $elements = $dom->getElementsByTagName('span'); $spans = array(); foreach($elements as $span) { $spans[] = $span; } foreach($spans as $span) { $span->parentNode->removeChild($span); } retur...

15
голосов
2ответов
8758 просмотров

Strip HTML tags and its contents

I'm using DOM to parse string. I need function that strips span tags and its contents. For example, if I have: This is some text that contains photo. <span class='title'> photobyile</span> I would like function to return This is some text that contains photo. This is what I trie...

2
голосов
6ответов
8040 просмотров

How to gain access to an element on the same level in the DOM?

<div id="dad"> <img id="mum"> <input> </div> With jQuery, how could i get access to the input element, get is value or set it for example? I can't work out how to access something on the same level.. and i dont want to be using ID's, just parent/child nodes so ...

5
голосов
7ответов
337 просмотров

Is it possible to write a JavaScript library that makes all browsers standards compliant?

I'm not a JavaScript wiz, but is it possible to create a single embeddable JavaScript file that makes all browsers standards compliant? Like a collection of all known JavaScript hacks that force each browser to interpret the code properly? For example, IE6 does not recognize the :hover pseudo-cl...

1
голосов
3ответов
539 просмотров

Regex challenge - find "foobar" in HTML document

I have a fairly long and complex HTML document, and I need to find all occurences of a given string, e.g. "foobar", unless it's between <a> and </a> anchor tags. The trouble is: it could be inside some text between the anchor tags, e.g. <a>this is a foobar test</a> an...

0
голосов
1ответов
1886 просмотров

How do I disable the click handler on a YUI Node?

I am wanting to be able to disable the click functionality of a radio button so I can uncheck it. However, when I uncheck it, the click still fires and the end result is a radio that unselects (and modifies other page elements accordingly), and then re-checks because of the onclick event. v...

4
голосов
2ответов
1567 просмотров

Why is the dom out of sync after jquery ajax call and refresh?

I have table that uses inline editing with ajax to modify the fields. The table is sorted by last name. If I change a last name so the row order is changed and then do a page refresh, the table is reordered but the field I changed still has the previous value in the dom. The input field does h...

7
голосов
1ответов
5713 просмотров

How can I replace a GWT widget in a Panel?

I have a Composite whose main widget has two children, thus: public MyComposite() { child1 = new FlowPanel(); child1.getElement().setId("child1"); child2 = new FlowPanel(); child2.getElement().setId("child2"); panel = new FlowPanel(); panel.add(child1); panel.add(ch...

1
голосов
3ответов
73 просмотров
2
голосов
1ответов
2777 просмотров

How to access webpage data from a firefox extension?

I have managed to get a custom very basic extension running in Firefox. What I want to do next is: Check if the user is on a desired webpage If yes: check the page on each postback for a hidden element containing a string If found: launch an external app with string parameter I have some e...

1
голосов
1ответов
602 просмотров

How do I copy a DOM sub tree between two webbrowser.HmtlDocuments?

A WinForm application. I want to scrape a part of an HTML web page and save it into a local html file. I have one local file, "empty.htm" (containing just "I'm empty" in the body), one remote web page, and two WebBrowser controls. WebBrowser1 navigates to the remote page, WebBrowser2 to the lo...