<script>
function loadXml(){
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
xmlDoc.load("BlogInfo.xml");
var visitNum= xmlDoc.getElementsByTagName('BlogInfo')[0].getAttribute("visitNum");
alert(visitNum);
}
</script>
</head>
<body οnlοad="loadXml()">
</body>
</html>
BlogInfo.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<BlogInfo ResName="blogInfo" bpId="斧头帮" blogId="73" templateId="1" visitNum="44" bpNum="85"><faceUrl></faceUrl></BlogInfo>
输出结果:44