dom

jQuery XML loading and then innerfade effect

Hello, I think I can explain myself without code, so for brevity's sake here we go: I am using jquery to pull data from an xml and put it into a ul on the page with each xml entry as a li. This is working great! However, what I am trying to do afterwards is use the innerfade plugin to make a simple animation between each of the li's...

Can I test for the end of the content of a text/plain file with Selenium or javascript?

I have a page that results in a text/plain file being displayed in the browser that looks like this: ... Admin Site Administration 2010-04-21 22:26:34 [email protected] Test Site Bob Smith 2010-04-21 22:27:09 [email protected] Admin Site Administration 2010-04-21 22:29:26 [email protected] I am trying to write a...

Alternative to before </body> tag inline Javascript

I know inline Javascript is frowned upon and with the new on-the-fly Javascript compressors that check for idle/unused function usage and omit the unused code, it seems good practice to have all your Javascript in an external file. My question is, in situations like FOUC (flash of unstyled content) which usually require little snippets ...

Find an element in DOM based on an attribute value

Hi, Can you please tell me if there is any DOM API which search for an element with given attribute name and attribute value: Something like: doc.findElementByAttribute("myAttribute", "aValue"); Thank you. ...

Eclipse hangs when rebuilding after the addition of an external JAR file.

I'm fairly new to Eclipse so if this is something simple I apologize, however when I attempt to add an external JAR file to my build path (specifically the "rt.jar" file which contains certain tools that I require) and then rebuild my project, Eclipse will hang at the end of the Build process. It'll get to 100% then just hang there usin...

Ordering DOM elements

Given two DOM elements, say a and b, how can we determine which comes first in the document? I'm implementing drag and drop for a set of elements. And the elements can be selected in any order, but when they are dragged, these elements need to be moved in the "correct" order. ...

How to add dimensions to dynamic img elements (Updated)

I use a Json call to get a list of image addresses, then I add them individually to a div like this. Unfortunately the image dimension is not part of the Json information. <div id="container"> <img src="A.jpg" alt="" /> <img src="B.jpg" alt="" /> ... </div> Do any of you JQuery geniuses know of a code that would flawlessly an...

Change the content of a <style> element through JavaScript

The Problem I have the following code: <html> <head> <style id="ID_Style"> .myStyle { color : #FF0000 ; } </style> </head> <body> <p class="myStyle"> Hello World ! </p> </body> </html> And I want to modify the contents of <style> through JavaScript. The Expected Solution The first solution was to use the innerHTML ...

document.evalute function giving exception

I have a code like res = doc.evalute(xpathExpr,doc, function(prefix) {return namespaces[prefix] || null;}, XPathResult.ANY_TYPE,null ); Here doc is DOM document node When i run for loop like this for(i in doc) alert(i); it gives evaluate method but when i tried to use this method on dom node ...

Swapping <li> elements with replaceChild possible?

I have a list of <li> elements: <ul id="mylist"> <li id="item1">Item 1</li> <li id="item2">Item 2</li> <li id="item3">Item 3</li> </ul> Can I swap two <li> elements - say item1 and item2 - with the replaceChild, one of the DOM tree modification methods? Will it work in all browsers? ...

Edit text with DOM

How do you edit text with DOM cms-like. //now editing in textarea and clicks button which have onclick='editText()' function editText() { var myvar = document.getElementById('myTextArea'); alert(myvar.textContent);//alerts oldtext still ? //would like it to have alerted the now new and edited text from textarea } ...

Unable to get nodeValue using DOMDocument class in PHP

I am Parsing a HTML document using DOMDocument Class in PHP, i wanted to get the nodeValue of a div element, but it is giving me null, <div id="summary"> Hi, my name is <span>ABC</span> <br/> address is here at stackoverflow... <span>.... .... </div> want to get the value inside the div, and the code i wrote wass $d...

Are event handlers in JavaScript called in order?

I know this is a simple question, but I haven't had the chance to test it in any browser other than Firefox. If I attach multiple event handlers to a single event on a single DOM element, are the event handlers guaranteed to be called in the order they were added? Or should I not rely on this behavior? ...

Getting id of any tag when mouseover

Hi, does anyone know how i can get the id of any element when the mouse is over ? I want to show a div (box) over the elements (tags) the mouse is over. I cannot modify the tags to include a mousover event. I want a global callback or something like that to have the id of the tag which is under the mouse pointer. Thanks ! ...

Is the javaScript not part of the DOM?

Why is it that scripts can still function even after the code used to create them is removed from the DOM? I ran into a situation where I wanted to prevent a broken script from running (@see my post). In my attempt to come up with a solution I wrote an extension with the following line (just to see what would happen). $('script', doc)...

jQuery parent element inner HTML

I am getting inner HTML of element by next way: $(this).context.innerHTML Then I am getting parent inner HTML: $(this).parent().context.innerHTML But this code returns same values. Any ideas what is wrong? ...

Load DOM before css?

My jQuery code sets the height of an element to 0px as soon as the page loads, then animates it to 500px. In my CSS, this element is already set to 500px (in case anyone has javascript turned off). I tried 'DEFER' on the tag where I link to the stylesheet so that the CSS loads in last of all, but that causes a blank white page to show ...

Is there a way to determine if a <select> dropdown menu is open?

I'm looking for a way to determine if/when a <select> element's menu is open. I don't need to force it to open or close, just figure out if it's open or closed at a given time. I can listen to events for focus/blur, mouseup/mousedown, etc., but I don't think I can reliably figure out the state of the menu from those events. For example,...

Javascript: getting element in dom tree when mouseover

Hi, When using : document.onmouseover = function(e) {} Is there a property which gives me the element in the dom tree ? For example, I can set a style to e.srcElement But, how can I later access this element to (for example) reset its style ? And how can I know at which place in the dom tree it is ? I want to be able to situate it i...

capturing click events on web-browser scrollbars

Hi, is it possible to capture a click event on a scrollbar? I have some code where i am observing the click and mousedown events on the document. However, it seems that when I click on the scrollbar, the event is not captured. This leads me to believe that the scrollbars aren't really part of the document. (Assumption :-)) Is this a corr...