日期:2014-05-16 浏览次数:20725 次
window.onload = init;
function init() {
document.getElementById("oldpd").onblur = checkOldpd;
}
var xmlrequest;
function ctreatehttp() {
if (window.XMLHttpRequest) //For general cases.
{
xmlrequest = new XMLHttpRequest();
}
else {
if (window.ActiveXObject) {
xmlrequest = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlrequest;
}
function checkOldpd() {
xmlrequest = ctreatehttp();
document.getElementById("oldpd").className = "thinking";
if (xmlrequest == null) {
alert("请求是个空值");
}
else {
alert("0");
var oldpd = document.getElementById("oldpd");
var mima = escape(oldpd);
var url = "checkoldpd.aspx?pd=" + mima;
xmlrequest.onreadystatechange = handle;
alert("1");
xmlrequest.open("GET", url, true);
xmlrequest.send(null);
}
}
function handle() {
if (xmlrequest.readyState == 4) {
if (xmlrequest.status == 200) {
alert("yes");
var img = document.getElementById("oldpd");
var str = xmlrequest.responseText;
alert(str);
if (str == "ok") {
img.className = "approved";
}
else {
img.className = "denied";
img.focus();
img.select();
}