Is there an error in my code or does it have to do with my Firefox 12 browser?

Wagner.R

New Member
I copied the following code from a tutorial, but still couldn't figure out whether I made a mistake somewhere or whether it has to do with the browser support. Thanks in advance for pointing out to me on what happened!\[code\]<html><head><script type="text/javascript">function loadXMLDoc(dname){ if(window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else { xttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET", dname, false); xhttp.send(); return xhttp.responseXML;}function change(text){ var xmlDoc = loadXMLDoc("dom.xml"); var x = xmlDoc.getElementsByTagName("title")[0].childNodes[0]; x.nodeValue = http://stackoverflow.com/questions/10628310/text; var y = xmlDoc.getElementsByTagName("title"); for(i=0; i<y.length; i++) { document.write(y.childNodes[0].nodeValue+"<br />"); }}function remove(node){ xmlDoc = loadXMLDoc("dom.xml"); var y = xmlDoc.getElementsByTagName(node)[0]; xmlDoc.documentElement.removeChild(y); alert("The element "+node+" has been removed!");}function prove(u){ var x = xmlDoc.getElementsByTagName(u); for (i=0; i<x.length; i++) { document.write(x.childNodes[0].nodeValue); document.write("<br />");}</script></head><body> <input type="button" value="http://stackoverflow.com/questions/10628310/remove" onclick="remove('book')" /> <input type="button" value="http://stackoverflow.com/questions/10628310/prove it" onclick="prove('book')" /></body></html>\[/code\]------------Update-------------------------Here's an XML file that may help:\[code\]<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada</author> <year>2005</year> <price>30.00</price> </book> <book category="cooking"> <title lang="en">Book 2</title> <author>Giada</author> <year>2005</year> <price>30.00</price> </book> <book category="cooking"> <title lang="en">Book 3</title> <author>Giada</author> <year>2005</year> <price>30.00</price> </book></bookstore>\[/code\]
 
Back
Top