var xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
xmlDoc.load("books.xml");
var node = xmlDoc.selectSingleNode("/feature/region/style");
alert(node.xml);

解决方案 »

  1.   

    <xml id="xml1">
    <feature xmlns:v="urn:schemas-microsoft-com:vml">
    <region>
    <style id="R01">
    <v:fill on="true" color="#ffff00" opacity="30%" />
    </style>
    </region>
    </feature>
    </xml>
    <script>
    var node=xml1.selectSingleNode("//style[@id='R01']/v:fill")
    alert(node.xml)</script>
      

  2.   

    xmlDoc.load("books.xml");
    这个books.xml是那里来得???
      

  3.   

    <xml id="xml1">
    <feature xmlns:v="urn:schemas-microsoft-com:vml">
    <region>
    <style id="R01">
    <v:fill on="true" color="#ffff00" opacity="30%" />
    </style>
    </region>
    </feature>
    </xml>
    <script>
    var node=xml1.selectSingleNode("//style[@id='R01']/v:fill")
    alert(node.xml)</script>
    这个不行啊
      

  4.   

    <body>
    <xml>
    <feature xmlns:v="urn:schemas-microsoft-com:vml">
    <region>
    <style id="R01">
    <v:fill on="true" color="#ffff00" opacity="30%" />
    </style>
    </region>
    </feature>
    </xml>
    <script>
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.loadXML(document.getElementsByTagName('xml')[0].innerHTML);
    alert(xmlDoc.selectSingleNode('/feature/region/style').xml);
    </script>
    </body>
      

  5.   

    document.getElementsByTagName('xml')[0].innerHTML  为空或不是对象。