W3Schools unable to replicate tryit editor

fveqpackj

New Member
I was testing some code on the tryit editor and was unable to replicate functionality when I save the code locally and was wondering it anyone had any ideas as to why this seems to happen. The code snippet is \[code\]<html><head><script type="text/javascript" src="http://www.w3schools.com/dom/loadxmldoc.js"></script></head><body> <script type="text/javascript">xmlDoc=loadXMLDoc("http://www.w3schools.com/dom/books.xml");for (j=0;j<xmlDoc.getElementsByTagName("book").length;j++ ){ x=xmlDoc.getElementsByTagName("book")[j].childNodes; y=xmlDoc.getElementsByTagName("book")[j].firstChild; for (i=0;i<x.length;i++) { if (y.nodeType==1) { //Process only element nodes (type 1) document.write(y.nodeName + " : " +x.childNodes[0].nodeValue + "<br />"); } y=y.nextSibling; }}</script></body></html>\[/code\]Can someone tell me what I'm doing wrong hereMany thanks in advanceEdit: Thanks to all for the w3schools tip. I think I abuse the tryit more than I should stop doing so
 
Back
Top