把一个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>

你可能感兴趣的:(把一个xml文档("note.xml")载入到xml解析器中)