把一个xml文档"note.xml"载入到xml解析器中

<!--把一个xml文档("note.xml")载入到xml解析器中--> <html> <head> <scropt type = "text/javascript"> funcion parseXML() { try { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); }catch(e) { try { xmlDoc = document.implementation.createDocument("","",null); }catch(e) { alter(e.message); return; } } xmlDoc.async = false; xmlDoc.load("note.xml"); document.getElementById("to").innerHTML = xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue; xmlDoc.getElementById("from").innerHTML = xmlDoc.getElementsByTagName("from")[0].childNode[0].nodeValue; docuement.getElementById("message").innerHTML = xmlDoc.getElementsByTagName("message").innerHTML = xmlDoc.getElementTagName("body")[0].childNodes[0].nodeValue; } </script> </head> <body onload = "parseXML()"> <h1>W3School.com.cn 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> </p> </body> </html>

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念