<html>
<head>
<title>访问XML文档</title>
<script language="javascript">
function GetInfo()
{
var document_xml = new ActiveXObject("Microsoft.XMLDOM");
document_xml.load("jianli.xml"); //加载info.xml
var RootNode = document_xml.documentElement; //获得info.xml文档的根节点
var FirstNode = RootNode.firstChild; //获得根标记的第一个子节点
var jibenxinxi = FirstNode.nextSibling; //获得nameNode节点的下一个兄弟结点
var current = jibenxinxi.firstChild;
var i = 0;
document.writeln("<html><head><title>" + FirstNode.nodeTypedValue + "</title><link type='text/css' href='css.css' rel='stylesheet' /></head><body>");
document.writeln("<center><h1>" + FirstNode.nodeTypedValue + "</h1></center>");
document.writeln("<table border='1' cellpadding='0' cellspacing='0' class='big' align='center'><tr><td class='bian'>" + current.tagName + "</td><td>");
document.writeln("<table border='1' cellpadding='0' cellspacing='0' width='100%' class='one' >")
while (current != null) {
if (i % 6 == 0) {
if (i == 0)
document.writeln("<tr>")
else document.writeln("</tr>\n<tr>");
}
if (current.tagName != "照片") {
document.write("<td>");
document.write(current.tagName + "</td><td>" + current.nodeTypedValue);
document.write("</td>");
} else {
document.writeln("<td colspan='5'> </td>\n</tr>")
}
current = current.nextSibling;
if (i % 6 == 2) {
if (i == 2) {
var aaa = RootNode.selectNodes("//照片");
var sss = aaa[0].getAttribute("宽");
document.writeln("<td rowspan='3' width='" + aaa[0].getAttribute("宽") + "'><img src=" + aaa[0].nodeTypedValue + " width='" + aaa[0].getAttribute("宽") + "' height='" + aaa[0].getAttribute("高") + "'/></td>");
}
document.writeln("</tr>");
document.writeln("<tr>");
}
i++;
}
document.write("</table></td>\n</tr>");
current = jibenxinxi.nextSibling;
while (current != null) {
document.writeln("<tr><td class='bian'>" + current.tagName);
document.writeln("</td><td><span>" + current.nodeTypedValue + "</span></td>\n</tr>")
current = current.nextSibling;
}
document.writeln("</table></head></body></html>");
}
</script>
</head>
<body onload="GetInfo()">
</body>
</html>