//hy 2012-9-14 附加码校验
/*参数设置:
ujiacheck(checkcodeEle,num,fujiamaid)
checkcodeEle:该输入框这个元素
num:是输入了5位的检查(5),还是失去焦点的检查(0) 标志位
fujiamaid:要显示检查结果的id
*/
var fujiamahtmlid='';
var xmlHttp=false;
var errwidth=0;
var errheight=0;
//创建XMLHTTPRequest对象
function createXMLHttpRequest() {
if(window.ActiveXObject) { //IE
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
window.alert("创建XMLHttpRequest对象错误"+e);
}
}
} else if(window.XMLHttpRequest) { //非IE
xmlHttp = new XMLHttpRequest();
}
if(!(xmlHttp)) {
window.alert("创建XMLHttpRequest异常!");
}
}
function fujiacheck(checkcodeEle,num,fujiamaid){
fujiamahtmlid=fujiamaid;
if(num==5&&checkcodeEle.value.length<5){
document.getElementById(fujiamaid).innerHTML='';
return;
}
if(num==0&&(checkcodeEle.value.length==0||checkcodeEle.value.length==5))
return;
var url="/CCBIS/fujiacheck.jsp?vcode="+checkcodeEle.value+"&inputrandom="+new Date().getTime();
try{
createXMLHttpRequest();
xmlHttp.onreadystatechange = checkconfirmresulet;
xmlHttp.open("POST", url, false);
xmlHttp.send(null);
}
catch(e){}
}
function checkconfirmresulet() {
if(!xmlHttp){
return;
}
var ready = xmlHttp.readyState;
if(ready==4){
var httpStatus = xmlHttp.status;
if(httpStatus==200){ //正常返回
var data = xmlHttp.responseText.replace(/\s/g,'');
var re=data.substring(0,1);
if(re=='0')
document.getElementById(fujiamahtmlid).innerHTML='';
else if(re=='1')
document.getElementById(fujiamahtmlid).innerHTML='';
}else{
return null;
}
}else{
return;
}
}