dom

Clone a node using Javascript DOM

I want to create a clone for below code using javascript DOM var summaryDiv = __createElement("div","sDiv","sDiv"+j); summaryDiv.onmouseover = function() {this.setAttribute("style","text-decoration:underline;cursor:pointer;");} summaryDiv.onmouseout = function() {this.setAttribute("style","text-decoration:none;");} ...

"return false" is ignored in certain browsers for link added dynamically to the DOM with JavaScript

I dynamically add an <a> (link) tag to the DOM with: var link = document.createElement('a'); link.href = 'http://www.google.com/'; link.onclick = function () { window.open(this.href); return false; }; link.appendChild(document.createTextNode('Google')); //someDomNode.appendChild(link); I want the link to open in a new window (I know i...

Using Firefox XML DOM to parse XML(RSS)

Any example on how to parse/have access to simple RSS feed elements in JS? I don't want to use any Microsoft specific objects. ...

Is it possible to access the SMIL timer from javascript?

I'm trying to use SMIL to animate the typing of text into a field embedded in a SVG. I tried the following code in both Chrome and a SMIL-enable Firefox nightly, but it has no effect: <svg xmlns="http://www.w3.org/2000/svg" xmlns:html="http://www.w3.org/1999/xhtml"&gt; <foreignObject> <html:input type="text" value=""> <...

Remove a dom element from the document, but save it as a variable?

Is there a way to remove a dom element from the document, but save it as a variable? I'm guessing I have to save the clone as a var, and then remove the original? Also, would such a technique store styles etc? ...

Replace node with innerhtml

With JavaScript I want to remove a specific DOM node and replace it with the innerHTML. For example I want to change <div> ... <div id="t1"> this is <b> the text </b> I want to remain. </div> ... </div> To <div> ... this is <b> the text </b> I want to remain. ... </div> ...

Select part of text in a tag

The DOM structure looks like this (existing website ... cant modify it): <table> <tr><td> <br><hr size="1"><strong>some heading 1</strong><br> <br>some text 1<br> <br><hr size="1"><strong>some heading 2</strong><br> <br>some text 2<br> </td></tr> </table> I want to manipulate it so that it looks like this <table> <tr><td> <br><hr si...

Problem loading images from DOM

I have problem in loading images using jquery. My program is such that it inserts as well as deletes from the same form. When I delete an image and inserts the image and after loading the jquery function the deleted image is shown. I have found inconstency in dom and actual location. The browser loads the images from dom not from actual...

IE page redirect hanging

My app does a POST to my local server to create a new DOM element, comes back and should redirect to the same page with the new element. The problem is when it gets back from the server, the app hangs for almost 2 minutes before doing the redirect. I've isolated the issue to the fact that IE seems to have trouble with my tree structure...

How to get the line number an xml element is on via the Java w3c dom api

Is there a way to lookup the line number that a given element is at in an xml file via the w3c dom api? My use case for this is that we have 30,000+ maps in kml/xml format. I wrote a unit test that iterates over each file found on the hard drive (about 17GB worth) and tests that it is parseable by our application. When it fails I thro...

Modifying DIV CSS properties from within a deeply nested IFRAME.

I'm working with a business intelligence tool that only gives me access to a deeply nested iframe to add code. Ideally I would like to use jQuery and/or plain old JavaScript to modify the left and position CSS of a div that is 3 iframes above my IFRAME. I have access to add JavaScript/HTML to divArea0_1 within the reportiframe IFRAME....

Javascript: "Dangling" Reference to DOM element?

It seems that in Javascript, if you have a reference to some DOM element, and then modify the DOM by adding additional elements to document.body, your DOM reference becomes invalidated. Consider the following code: <html> <head> <script type = "text/javascript"> function work() { var foo = document.getElementById("foo"); alert(foo ==...

Problems with creating XML with DOMDocument in PHP

The below code is fetched from php.net (http://docs.php.net/manual/en/domdocument.savexml.php). My problem is - it doesn't work. My only output from this is: "Saving all the document: Saving only the title part:". What am I missing here? $doc = new DOMDocument('1.0'); // we want a nice output $doc->formatOutput = true; $...

JS DOM: Get elements by text content.

Hello! I am looking for a way to perform fulltext search on the DOM tree with JS. In two words, I would like to retrieve the list of text nodes which contain a given string. I've tried mootools' Element.getElements ( ':contains[string]' ) but I can't get it to work with strings containing whitespace. EDIT: jQuery and mootools seem to ...

unable to trigger event in IE during cloning

Following is the code which will clone a set of div with their events(onclick) which is working fine for FF but in case of IE it is not firing events associated with each div. <html> <head> <style type='text/css'> .firstdiv{ border:1px solid red; } </style> <script language="JavaScript"> function sho...

SetTimeout() and ClearTimeout() to stop freezing of IE8 and dialog aobut scripts overruning

I have some 3rd party software where i can open nsites and run javascript. Because some sites make me stack overflow i ussed the trick wih Registry to modify Styles WRAD to FFFFFF. Still some sites may do stack overflow due to DOM. I thought on start of running each site i would do javascript: setTimeout("window.status='one';",10000); ...

PHP DOMNode entities and nodeValue

When getting the nodeValue of a DOMNode object that has entities in the nodeValue (i.e. a & gt;) then it converts the entity into it's printable character (i.e. >) Does anyone know of a way to get it to keep it as an entity, it really messes up string comparisons when it converts to something unexpected. The following code reproduces t...

DOM accessing element JS

Given the following xml <rss> <channel> ... <pubDate>20/30/2099</pubDate> ... <item> ... <pubDate>10/30/2099</pubDate> ... </item> ... <item> ... <pubDate>40/30/2099</pubDate> ... </item> ... </channel> </rss> how would I efficiently access pud...

Html object container

Hello, Does someone knows how can I change the container for my drop down box? I have 3 "TD" tags and I would like to move the drop down between them, using client side code. TY ...

How can i get the absolute position of an SVG element inside the SVG tag using javascript?

Hi! I am trying to return the absolute position of an element in a SVG. I have tried using basic javascript functions to return the relative position but I only have access to the contentDocument since the SVG is embeded using an OBJECT tag. Because of this I cannot recurse thru the elements to find the position of the element positio...