日期:2014-05-17 浏览次数:20630 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> TESTING </title>
<script type="text/javascript">
function loadXMLDoc(dname)
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load(dname);
return(xmlDoc);
}
catch(e) {alert(e.message)}
return(null);
}
</script>
</head>
<body>
<script type="text/javascript">
xmlDoc=loadXMLDoc("book.xml");
x=xmlDoc.getElementsByTagName("title");
document.write(x[1].childNodes[0].nodeValue);
</script>
</body>
</html>