日期:2014-05-16 浏览次数:20430 次
function showlog(szLog){
szLog = "[" + Date() + "]:" +szLog + "\n";
txt.value = szLog + txt.value;
}
function getObjXMLReq()
{
var objXMLReq;
//for Mozilla and Safari etc.
if (window.XMLHttpRequest){
objXMLReq = new XMLHttpRequest();
}
// IE5 for the mac claims to support window.ActiveXObject, but throws an error when it's used
else if (window.ActiveXObject && !(navigator.userAgent.indexOf('Mac') >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)){
objXMLReq = new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLReq;
}
function adReq() {
var objXMLReq = getObjXMLReq();
showlog("getObjXMLReq");
if(!objXMLReq){
return;
}
var url = "http://www.bbb.com/index";
objXMLReq.open("GET", url, false);
objXMLReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ret = objXMLReq.responseText;
showlog(ret);
}