dom

At which point in the life of an xmlHttpRequest object is serialised XML parsed into a DOM?

In JavaScript, xmlHttpRequest.responseXML() returns a DOM Document object. The DOM Document object is created from an XML-structured HTTP response body. At what point during the life of an xmlHttpRequest object is the XML string parsed into the DOM Document? I can imagine it may occur in one of two places. When responseXML() is calle...

XML node with Mixed Content using PHP DOM

Is there a way to create a node that has mixed XML content in it with the PHP DOM? ...

How can we access the value of a radio button using the DOM?

How can we access the value of a radio button using the DOM? For eg. we have the radio button as : <input name="sex" type="radio" value="male"> <input name="sex" type="radio" value="female"> They are inside a form with name form1. When I try document.getElementByName("sex").value it returns 'male' always irrespective of the che...

Dynamically Resizing an Iframe

Hello All, I can see that this question has been asked several times, but none of the proposed solutions seem to work for the site I am building, so I am reopening the thread. I am attempting to size an iframe based on the height of it's content. Both the page that contains the iframe and it's source page exist on the same domain. I ...

How to select html nodes by ID with jquery when the id contains a dot?

If my html looked like this: <td class="controlCell"> <input class="inputText" id="SearchBag.CompanyName" name="SearchBag.CompanyName" type="text" value="" /> </td> How could I select #SearchBag.CompanyName with JQuery? I can't get it to work and I fear it's the dot that's breaking it all. The annoying thing is that renaming all my i...

element not being removed from DOM

I have code to delete a record from mysql, displayed in a table via php, and subsequently delete the table row from the page. The record is deleted, however nothing changes in the page or the DOM, and it should change instantly. Here is the javascript code to delete from the DOM function deleteItem(layer, url) { var xmlHttp=GetXmlH...

Javascript: What Document object property can be dynamically rendered after a Web page is rendered?

According to a school assignment, only one property of the Document object can be dynamically changed after a Web page is rendered. Is it body or cookie? ...

Why is innerHTML = "" slow in Firefox

I am testing the speed of different methods to dynamically add html elements to the DOM. I've build a tester here (code is working version, so pretty sloppy). The results are (very) different for different browsers with Chrome getting all the points for speed, and Opera a good second - but that's not the question here. In Firefox I det...

JavaScript getting name of SELECT option

Take following: <select id="test"> <option value="1">Test One</option> <option value="2">Test Two</option> </select> How do I get to "Test One" and "Test Two" using javascript document.getElementsById('test').selectedValue returns 1 or 2, what propery return actual name of selected option ? Thanks for help! ...

What's the best way to get a list of the contents of a specific group of DOM elements in javascript?

The basic scenario: I've got a series of elements on an HTML page, generated dynamically. (Currently, they're all divs, but they don't need to be.) What I want is a javascript function that will loop though all of those divs (or whatever) looking for the presence of a specific value. What's the best, most cross-browser way to do this?...

Referring to a div inside a div with the same ID as another inside another

How can I refer to a nested div by id when it has the same id as a div nested in a similarly named div eg <div id="obj1"> <div id="Meta"> <meta></meta> </div> </div> <div id="obj2"> <div id="Meta"> <meta></meta> </div> </div> I want to get the innerHTML of meta document.getElementById('obj1').getElem...

Prototype/Scriptaculous: Selecting groups of paragraphs (<p>) by clicking on them.

A list of paragraphs (<p>) is given. As soon as the user clicks on paragraph A the class of paragraph A changes to "activated". Now the user selects paragraph B and all the paragraphs between A and B change their class to "activated". By clicking on B again, only A remains with the class "active". By clicking on A the class "active" ...

Can I create an XML document from dtd file in Java?

I have a simple DTD file with elements and attributes specifications. Can i create a suitable XML file (with DOM) parsing this DTD with Java and no external APIs? Thanks in advance ...

Javascript clientHeight inconsistency

When writing a Javascript a function that I had gotten help from earlier, which gets the height of an element that is hidden, someone reffered me to the Prototype function getDimensions(). In the example, they set "visibility: hidden; position: absolute; display: block;", which effectively lets us measure what the clientHeight would be i...

how to get fastest DOM insertion speed

What are the best practices for doing DOM insertion? Is it faster to insert large chunks of html vs element at a time in a loop? Does it matter what html you are inserting, or only how big the chunk is? It it faster to insert a table, vs inserting just the rows using the table hack? Thanks ...

Nokogiri: Putting a group of <p> inside a <div>

I'd like to figure out a way on how to get to the HTML result (mentioned further below) by using the following Ruby code and the Nokogiri Rubygem: require 'rubygems' require 'nokogiri' value = Nokogiri::HTML.parse(<<-HTML_END) "<html> <body> <p id='1'>A</p> <p id='2'>B</p> <h1>Bla</h1> <p id='3'>C</p> ...

Why would jquery return 0 for an offsetHeight when firebug says it's 34?

So I have a div who's content is generated at runtime it initially has no height associated with it. When it's generated according to firebug and from what I can alert with js the div still has a height of 0. However, looking at the read-only properties with firebug I can see that it has an offset height of 34. It's this value that I ...

DOM element width can be non-integer?

I have some one page whose div elements are aligned by JavaScript. The JavaScript just check a set of div elements to find the max offsetWidth, then set all div elements' width to be the max offsetWidth. It works perfect in most browsers and locales, but it fails on french-France in Firefox on Mac. In this case, the content of div wraps....

Using DOMXPath to replace a node while maintaining its position ...

Ok, so I had this neat little idea the other night to create a helper class for DOMDOCUMENT that mimics, to some extent, jQuery's ability to manipulate the DOM of an HTML or XML-based string. Instead of css selectors, XPath is used. For example: $Xml->load($source) ->path('//root/items') ->each(function($Context) { e...

What's the correct way for a cross-browser HTML layout?

I just read codes of a web product that is supposed to support multiple modern browser(including FireFox 3.X, Safari 3.X and IE7+, but not including IE6-). The HTML code uses div instead of table to create table-like effects. Actually, the div's are organized like this: <div> <div> <div style="float:left" id="h...