獲得兼容的xmlDocument

//定義一個函數getXmlDocument();

function getXMLDocument(){

var xDocument=null;

if(document.implementation && document.implementation.createDocument(){

 xDocument=document.implementation.createDocument(" "," ",null);//Mozilla

}else if (typeof ActiveXOBject  !="undefined"){

   var maXmlAx==null;

   try{

    msXmlAx=new ActiveXObject("Msxml2.DOMDocument");//newIE

    }catch(e){

     msXmlAx=new ActiveXObject("Msxml.DOMDocument");//oldIE

      }

      xDocument=msXmlAx;

    }

   if(xDocument==null || typeof xDocument.load=="undefined") {

     xDocument=null;

    }

   return xDocument;

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章