var count;
var oXML=new ActiveXObject("Microsoft.XMLDOM");
oXML.async=false;
var url="调用servlet";
oXML.load(url);
alert(oXML.documentElement);
var currNode = oXML.documentElement.selectSingleNode("Count");
if(currNode==null){
window.alert ("Data format error!");
window.alert (oXML.xml);
return null;
}
else{
count= currNode.text;
}
if(count=="0"){
if((pNotFoundMessage+""!="undefined")&&(pNotFoundMessage!="")&&(pNotFoundMessage!=null)){
alert (pNotFoundMessage);
return null;
}
else{
alert( "Code not exist!");
return null;
}
}
var currNode = oXML.documentElement;
下面可以从xml文件中获取数据,更新html页面。