日期:2014-05-17 浏览次数:20718 次
window.onload = function () {
xhr = new createXhr();
LoadCountQY();
}
function LoadCountQY() {
xhr.open("get", "MainPageQY.ashx", true);
xhr.setRequestHeader("If-Modified-Since","0");
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var msg = xhr.responseText;
alert(msg);
if (msg != null || msg != "") {
var json = eval(msg);
LoadQY(json);
}
} else {
alert("readyState:" + xhr.readyState + "----status:" + xhr.status);
}
}
xhr.send(null);
}
function createXhr() {
var xhobj = false;
try {
xhobj = new ActiveXObject("Msxml2.XMLHTTP"); // ie msxml3.0+
} catch (e) {
try {
xhobj = new ActiveXObject("Microsoft.XMLHTTP"); //ie msxml2.6
} catch (e2) {
xhobj = false;
}
}
if (!xhobj && typeof XMLHttpRequest != 'undefined') {// Firefox, Opera 8.0+, Safari
xhobj = new XMLHttpRequest();
}
return xhobj;
}