陪你在路上
║ ║ ║-往事不要再提-----人生已多风雨-║ ║ ║
var isIE = document.all;
if(isIE)
{
    var oXmlDom = new ActiveXObject("Microsoft.XMLDOM");
}
else
{
    var oXmlDom = document.implementation.createDocument("","",null);
    Element.prototype.selectNodes = function(sXpath){
        var oEvaluator = new XPathEvaluator();
        var oResult = oEvaluator.evaluate(sXpath,this,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);
        var aNodes = new Array;
        if(oResult!=null)
        {
            var oElement = oResult.iterateNext();
            while(oElement)
            {
                aNodes.push(oElement);
                oElement = oResult.iterateNext();
            }
        }
        return aNodes;
        
    };        
}
if(!oXmlDom)oXmlDom = new ActiveXObject("Microsoft.XMLDOM");
        
function loadXML()
{
    try{
        oXmlDom.async="false" 
        if(isIE)
        {
            oXmlDom.setProperty("SelectionLanguage","XPath");
        }
        oXmlDom.load("/XML/City.xml");
    }
    catch(e)
    {
        var xhr = new XMLHttpRequest();  
        xhr.open("GET", "/XML/City.xml", false);  
        xhr.send(null);  
    
        oXmlDom = xhr.responseXML;  
    }
}
posted on 2011-11-22 10:35  zhaoguo435  阅读(2846)  评论(2编辑  收藏  举报