OZONE Asylum
Forums
DHTML/Javascript
Get the html code inside an xml tag
This page's ID:
30388
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Now, IE is sucking my blood..., everything is working fine in FF (2.0 as well as 3.0). I am getting the document element for the XML returned from the server and operating over it, but IE seems to give me a problem in appendChild, which I am invoking on the temporary DIV element. Here is the code for you: var xmlPage = searchObject.responseXML.documentElement; var titlenodes = xmlPage.childNodes[getIndex(0)].childNodes[getIndex(1)].childNodes; //This is giving me the TITLE node var titlediv = document.createElement('body'); var codenodes = xmlPage.childNodes[getIndex(0)].childNodes[getIndex(3)].childNodes; //This is giving me the CODE node var htmlcodediv = document.createElement('body'); for(ttlcnt=0 ; ttlcnt<titlenodes.length ; ttlcnt++) { // 1 means an html Node Element. if (titlenodes[ttlcnt].nodeType == 1){ titlediv.appendChild(titlenodes[ttlcnt]); } // When we have only text title, no need to check for nodeType if(titlenodes[ttlcnt].nodeType == 3 && titlenodes.length == 1){ titlediv.appendChild(titlenodes[ttlcnt]); } } for(i=0 ; i<codenodes.length ; i++) { // 1 means an html Node Element. if (codenodes[i].nodeType == 1){ htmlcodediv.appendChild(codenodes[i]); } } getElement('search_title_'+count).innerHTML = titlediv.innerHTML; document.getElementById(div).innerHTML = htmlcodediv.innerHTML; In IE, the [i]appendChild[/i] operation fails... thanks in advance, ankit [small](Edited by [url=http://www.ozoneasylum.com/user/6646]jainanki[/url] on 07-08-2008 23:10)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »