dom

Why does a parameter of a JavaScript function return 'undefined'?

I'm trying to write a simple a JS function which randomly rotates the background-image of a CSS block per 1 second. I want to add the name of the block and the number of images from paramaters, so the function can be as flexible as possible and a I can call multiple instances of it on one page. The problem is that I get 'nameofparamter u...

Adding Elements inside another DOM element in MooTools

Can I add an object of Elements inside another DOM element using grab or inject or anything else? There are two items in the object, both of type Element that are created through Javascript: var firstElem = new Element("div", {text: "something"}); // <div>something</div> var secondElem = new Element("div", {text: "else"}); // <div>...

Detect when ALL HTML page rendering has taken place

I am working with a pretty complicated .aspx page that is full of controls (Telerik, Ajax, etc.) that all expand, collapse, show, hide, etc. when the page is loaded. Since this rendering happens on the client-side and can take different lengths of time based on the users machine specs, is there a way to detect when all (or some) renderi...

Finding out what line number an element in the dom occurs on in Javascript?

Though I've never heard of this but, is it possible to retrieve a node from the DOM using JS, and then find out on what line of the file that node occurred on? I'm open to anything, alternative browsers plugins/add-ons etc...it doesn't need to be cross-browser per say. I would assume that this would be possible somehow considering that...

html DOM generation and html regeneration out of DOM

Hi I want to get the html content of an html file and modify some areas (actually I want to translate the text in the html page )and then REBUILD the new html file out of my modified DOM tree.Can anybody please show me the way how I can do that ?I have found html DOM parsers,but they dont regenerate the modified html file for me .they ...

add element to xml file with xerces

i have an xml file named LOD.xml and in this file there is a list of models. i want to add another DomElement to this file. i dont want to parse all the list again. i just want to parse file and get DomDocument and RootDomElement. after appending my new DomElement to the RootDomElement, i want to write DomDocument to this file back aga...

Porting code that used SimpleXML to Dom in PHP

I have a class that extends PDO to give it the ability to pull the configuration from an xml file. Unfortunately the our hosting provider has disabled SimpleXML so I need to refactor my code to use Dom, which is available. I am using the following code: class xmlPDO extends PDO { public function __construct($xml_uri){ $xml...

Writing a script to DOM and having it run before DOM is done rendering

My JavaScript (say File 1) needs to fetch another JS file (say File 2) from my server and have it finish executing before the DOM is done rendering. File 2 is actually an ad script (e.g. AdSense) which uses document.write. I have noticed that if I fetch File 2 by creating a new script tag from within File 1 and appending it to the head n...

Offline Gecko reference.

Hi All, I was trying to find offline version of Gecko DOM reference on net (https://developer.mozilla.org/en/Gecko_DOM_Reference) but was unsuccessful. I will be travailing next two days and if some points to a resource I can finish my work during this time and enjoy my weekend ;). Thanks in advance....... ...

DOM Insertion: Are some tag types faster when inserting into DOM?

Hi, I have a web page that used client side templating to update part of the page based on json obtained via an ajax call. At the moment I'm using an unordered list where inside each Li I have markup to display information about a product. I'm interested to know, are some tags faster when inserting into the DOM than others? That is to...

Whats the rendering difference between a span and label tag?

So I understand the functional difference between the span and label tags... however it appears there is also a rendering difference between the tags and I can't seem to figure out what it is? Does anyone know the rendering difference between span and label? Thanks ...

Using Javascript to change the method/function an HTML element calls.

I was wondering if its possible to use Javascript to change the function/method that an HTML element calls. Example: <input type="button" id="some_id" name="some_name" value="A Button" onclick="someFunction()" /> I now want to use Javascript to change the method/function called on the onclick event to another function has displayed ...

Remove DOM Element from iFrame using Javascript

Hi, I'm new to javascript so please excuse if this question is trivial. I have a dynamic Webpage that includes an iFrame where external html Code is included. Now I need to dynamically remove an element from this iFrame. Firebug give's me the following XPath Entry for the Element. /html/body/div[2]/div[2]/ol/table/tbody/tr/td/a/img M...

How might I use jQuery to move table row elements around in some way?

I have a table like this: <table> <tr> <td>something</td> </tr> <tr> <td>something else</td> </tr> </table> now based on an id that is in the td i want to move the tr's around so that they are in the position held by the id. any ideas on how to do this? ...

How to parse DOM with jQuery?

<div class="top"> <div class="branch"> <div class="branch"> <div class="leaf">click</div> </div> </div> </div> When I click on the inner most <div class="leaf">,how to get all its way from top to itself: top,branch,branch,leaf EDIT to clarify I want to have the path in an array: arr[0]='top'; ar...

Google Chrome Extension - Accessing The DOM

I have been searching around the web to find out how to access the current tabs DOM to extract information out of a page from the background.html. So far I have had no luck, or at least nothing I could get to work properly. To state the problem simply. I would like to get src of a iFrame on the page. Any Suggestions? ...

DOM Support Or Maybe PHP Version

Hi , I keep getting the following error "Call to undefined function domxml_new_doc()" Is this because I don't have DOM support on or could it be down to my version of PHP ? Thanks ...

Creating nested elements

I am attempting to dynamically create the following using data from an array <li><a href="#" class="red" id="5"><span>Some text</span></a></li> At the moment, I'm creating it in a rather simple way var link = '<li><a href="#" class="' + this.cssClass + '" id="' + this.id + '"><span>' + this.text + '</span></a></li>'; $('#options')....

Effect of adding excessiv ID's on html / js rendering performance

A project I'm currently working currently has about 10 ULs, each which will have anywhere from 10-50 elements in them. Its been proposed that each of those elements have a unique ID specified to it that we will use to update content with via Javascript. This seems like a large number of IDs to add to a page, but each field will have ...

Capture text including line breaks, whitespace from DOM in jQuery?

Suppose I have the following HTML on the page: <div id="Test"> One Two </div> and this jQuery: var contents=$("div#Test").html() In Chrome and Firefox, the resulting string contents includes line breaks - that is, between "One" and "Two" there's character code 10. In IE, though, it seems to collapse any white space and line feeds t...