rogerio Posted June 3, 2009 Share Posted June 3, 2009 Before I begin, yes I saw the comment "// IE 5 and IE 6". "The following code is from http://www.w3schools.com/xml/xml_examples.asp and works in Firefox but not IE7, why? Thanks...One note, if I try to use the code in MS Office scripting, I get an error for "Line 11, Column 3", i.e. "xmlDoc.send("");". <html><head><script type="text/javascript">function loadXMLDoc(dname){var xmlDoc;if (window.XMLHttpRequest) { xmlDoc=new window.XMLHttpRequest(); xmlDoc.open("GET",dname,false); xmlDoc.send(""); return xmlDoc.responseXML; }// IE 5 and IE 6else if (ActiveXObject("Microsoft.XMLDOM")) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load(dname); return xmlDoc; }alert("Error loading document");return null;}</script></head><body><h1>W3Schools Internal Note</h1><p><b>To:</b> <span id="to"></span><br /><b>From:</b> <span id="from"></span><br /><b>Message:</b> <span id="message"></span><script type="text/javascript">xmlDoc=loadXMLDoc("note.xml");document.getElementById("to").innerHTML=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;document.getElementById("from").innerHTML=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;document.getElementById("message").innerHTML=xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;</script></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.