dom

Changing the innerHTML of elements in a nested div tag..

It has become apparent I'm quite an idiot - there was an error in my JS above this code - sorry for the bother - all the below are correct in one form or another.. (also I'm selecting the one that works in IE is the correct answer).. Thanks for all your help!! -- Representative code only - I need to know how to change the innerhtml of t...

Change innerHTML of a php DOMElement

How to Change innerHTML of a php DOMElement ? ...

Unable to add a row to a HTML table dynamically

I am unable to add a row to a HTML table dynamically. I am using IHtmlDocument2 to create tr and td elements and IHtmlElement to set attributes and IHtmlDomNode to add created node to the document hierarchy. Please anyone help me to solve the above problem. I am traversing through the document when I get the tr tag I have created the t...

Python: Is there a built in package to parse html into dom

I found HTMLParser for sax and xml.minidom for xml. I have a pretty well formed html so I don't need a too strong parser - any suggestions? ...

JavaScript DOM: transfer element between frames

I'm using the following jQuery code within an iframe (same origin) to try to move a node from the iframe to the main (top) document. var dest = $(window.top.document).find('#dest_id'); dest.append($('#source_id')); The following works ok: window.top.document.getElementById('dest_id').innerHTML = document.getElementById('source_id').i...

Iterate over framesets in JavaScript?

How can I list all FRAMESET elements in an HTML document using JavaScript? I believe it to be possible to select these elements in the DOM tree because the DOM Inspector plugin for Firefox is able to list all the FRAMESETS in a page. ...

YUI: ensuring DOM elements and scripts are ready

If I put my inline script after the DOM elements it interacts with, should I still use YUI 3's domready event? I haven't noticed any problems, and it seems like I can count on the browser loading the page sequentially. (I already use YUI().use('node', ... to make sure the YUI functions I need have been loaded since the YUI script is a ...

How to resolve "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]" error..

i have a json object returned from ajax and when i alert it, it is displayed correctly and i try to add those into a unordered list and add that to a place holder div, but throws the above error.. function handleResponse() { if(httpa.readyState == 4){ var response = httpa.responseText; //alert(response); if(response!='empty'...

Applying jQuery attr value to new DOM elements (result of AJAX query)

Hello everyone, I have a div on a page whose contents is replaced by an AJAX request when the user selects an option from a select list. When the page loads, I issue a command to disable the autocomplete feature for all of the pages text input elements: //Stop that pesky browser autocomplete $('input[type=text]').attr("autocomplete", "...

Replacing XML in File from "Document" in Java

Hi, after processing my first steps in working with XML in java I am now at the point where I want to update some data in my XML/GPX file... Reaplacing it in my "Document" data type works great :) How here comes the question: how can I store the changed "document"-model back to my file? Do I have to do this by using the standart file-...

Iterate over framesets with XPath expression in JavaScript?

Why does the following JavaScript, when run in Firefox 3.6.3, delete all FRAMESET elements in a document, but the similar script that instead uses an XPath expression to select the FRAMESET elements, does not? Is document.evaluate() simply unable to match FRAMESET elements? Is there an error in the XPath expression? Is there some othe...

Firefox DOMParser problem

For some reason DOMParser is adding some additional #text elements for each newline \n for this url http://rt.com/Root.rss ...as well as many other RSS I've tried. I checked cnn/bbc feeds, they don't have newlines and dom parser handling them nicely. So I have to add the following before parsing it var xmlText = htmlText.replace(/\n[ ...

How to get all <img> tags inside a text selection?

I've looked around for a while, but there doesn't seem to be a simple way to do this. jQuery doesn't help the in least, it seems to entirely lack any support for selection or DOM ranges. Something which I hoped would be as simple as $.selection.filter('img') seems to only be doable with dozens of lines of code dealing with manually enume...

<span> tag selection problem within anchor using jquery

Dear expert, I have facing a problem to select span tag using jquery. Please give a solution. code: <ul> <li> <a href="#Document1">Document 1 <span id="tab_close> x </span> </a> </li> </ul> ...

IE performance issues with offsetHeight and offsetWidth

I have a site that grabs the response text from an AJAX call and does 'innerHTML' on a div that is going to contain it. After I do the 'innerHTML' I process the DIV by traversing the whole hierarchy of nodes and grabbing their [offsetWidth/offsetHeight] to do some operations with it. Why not css style width/height? because sometimes thos...

Why does the DOM have both window and self?

Why does the DOM have an object called self and another called window when they are the same thing? To add to the confusion window has a property called self so: window === window.self === self Why is it like this? Which one should I use? ...

CData section not finished problem

When I use DOMDocument::loadXML() for my XML below I get error: Warning: DOMDocument::loadXML() [domdocument.loadxml]: CData section not finished http://www.site.org/displayimage.php?album=se in Entity, Warning: DOMDocument::loadXML() [domdocument.loadxml]: Premature end of data in tag image line 7 in Entity Warning: DOMDocument::loadXM...

Is there a way to parse XML via SAX/DOM with line numbers available per node.

I already have written a DOM parser for a large XML document format that contains a number of items that can be used to automatically generate Java code. This is limited to small expressions that are then merged into a dynamically generated Java source file. So far - so good. Everything works. BUT - I wish to be able to embed the line ...

How to scrape the first paragraph from a wikipedia page?

Let's say I want to grab the first paragraph in this wikipedia page. How do I get the principal text between the title and contents box using XPath or DOM & PHP or something similar? Is there any php library for that? I don't want to use the api because it's a bit complex. Note: i just need that to add a widget under my pages that disp...

Possible to get list item (<li>) label with JavaScript?

If I've got a ul with 3 items in it and the list-style-type is set to lower-alpha, I end up with this a. Item 1 b. Item 2 c. Item 3 With jQuery, I can easily get the value of any item you click - "Item 1" if I click the first. But can I get the list item label? In this case a? ...