温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Ajax无刷新中文验证码
当前文件路径:ChineseCode/js.js

1// JScript 文件 2
//该源码下载自www.51aspx.com(51aspx.com) 3
4
//1.我们首先创建一个全局变量 5
//2.我们在创建一个XmlHttpRequest对象 6
var xmlHttp; 7
8
function createXmlHttpRequest() 9
{ 10
if(window.XMLHttpRequest) 11
{ 12
xmlHttp=new XMLHttpRequest(); 13
14
if(xmlHttp.overrideMimeType) 15
{ 16
xmlHttp.overrideMimeType("text/xml"); 17
} 18
} 19
else if(window.ActiveXObject) 20
{ 21
try 22
{ 23
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 24
} 25
catch(e) 26
{ 27
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 28
} 29
} 30
if(!xmlHttp) 31
{ 32
window.alert("你的浏览器不支持创建XMLhttpRequest对象"); 33
} 34
return xmlHttp; 35
} 36
37
38
function ReBtn() 39
{ 40
//document.getElementById("Img").src="image/load.gif"; 41
window.location.reload(); 42
} 43
44
function ValidateCode() 45
{ 46
createXmlHttpRequest(); 47
48
var url="ValidateCode.aspx?Code="+document.getElementById("TxtAccept").value; 49
50
// window.alert(document.getElementById("TxtAccept").value); 51
52
//var url="DisposeEvent.aspx?Name="+document.getElementById("UserName").value 53
54
xmlHttp.open("GET",url,true); 55
56
xmlHttp.onreadystatechange=ValidateResult; 57
58
xmlHttp.send(null); 59
} 60
61
function ValidateResult() 62
{ 63
if(xmlHttp.readyState==4) 64
{ 65
if(xmlHttp.status==200) 66
{ 67
if(xmlHttp.responseText=="YES") 68
{ 69
window.alert("正确"); 70
} 71
else 72
{ 73
window.alert("错误的验证码"); 74
75
window.location.reload(); 76
} 77
} 78
} 79
}




}
}