<XML ID="MyTest">
<?xml version="1.0" encoding="utf-8" ?>
<Data>
<Key Pope="8"> </Key>
</Data>
</XML>
<script type="text/javascript">
function DisableStyle() {
//HERE: 如何取Pope的值?
}
</script>
当JS与XML在同一个HTML文件时,JS如何读出POPE的值?我是新手.谢谢大家!!
------解决方案--------------------
var oNode = MyTest.XMLDocument.selectSingleNode("Data/Key");
alert(oNode.getAttribute("Pope"));
------解决方案--------------------
MyTest是XML标签的id,IE下,id存在的话应该是可以的
var oNode = document.getElementById("MyTest").XMLDocument.selectSingleNode("//Key");