/* Ajax获取页面HTML通用方法 2006-11-19 by Jinti ZR 在 IE 6 及 MOZILLA 5 下测试通过 注意:仅限获取本地UTF-8编码 */ /* 返回XMLHTTP对象 CheckXmlHttp() : XMLHTTP Object xmlobj : 外部定义新的对象 */ function XmlHttpObj(xmlobj) { var checkxml=true; xmlobj=null; //for IE try { xmlobj=new ActiveXObject("Msxml2.XMLHTTP"); return xmlobj; } catch(e) { checkxml=false; } if (!checkxml) { try { xmlobj=new ActiveXObject("Microsoft.XMLHTTP"); checkxml=true; return xmlobj; } catch(e) { checkxml=false; } } //for mozilla if (!checkxml) { try { xmlobj = new XMLHttpRequest(); checkxml=true; return xmlobj; } catch(e) { checkxml=false; } } return xmlobj; } /* 获取页面代码 iDocId:页面元素的ID号 strURL:要获取页面的URL iTimeId:清理时间 iWidth:图层或FRAME的宽度 iHeight:图层或FRAME的高度 */ function getPageCode(xmlobj,iDocId,strURL,iTimeId,iWidth,iHeight) { if (null!=xmlobj) { xmlobj.open("GET",strURL+"&"+new Date().getTime(),true); xmlobj.onreadystatechange=function() { if (xmlobj.readyState==4) { if (xmlobj.status==200 || xmlobj.status==0){ document.getElementById(iDocId).innerHTML = "
"+xmlobj.responseText+"
"; if (null!=iTimeId && ""!=iTimeId) { clearInterval(iTimeId); //alert(xmlobj.responseText); } } } } xmlobj.send(null); } else { document.getElementById(iDocId).innerHTML=""; document.write("
"); if (null!=iTimeId && ""!=iTimeId) { clearInterval(iTimeId); } } } /* 页面LOADING显示 iDocId:页面元素的ID号 strCss:Css样式 strStyle:自定义Style */ function SetLoadingStyle(iDocId,strCss,strStyle){ var showCode=""; showCode=showCode+"
"; showCode=showCode+""; showCode=showCode+"


请稍候!页面正在加载中......

"; showCode=showCode+""; showCode=showCode+"

"; //alert(showCode); document.getElementById(iDocId).innerHTML=showCode; }