<script>
var chars=[];
for (var r=48;r<=57;r++)
{
chars.push(String.fromCharCode(r));
}
for (var min=97;min<=122;min++)
{
chars.push(String.fromCharCode(min));
}
for (var max=65;max<=90;max++)
{
chars.push(String.fromCharCode(max));
}
//debugger;
function getCode(){
for (var i=0,code=[];i<4;i++)
{
var r=Math.floor(Math.random()*62);
code.push(chars[r]);
}
return code.join(" ");
}
var code=getCode();
//debugger;
var input;
while((input=prompt("请输入验证码:"+code)).toUpperCase()!=code.toUpperCase()){
alert("验证码输入错误,请重新输入")
code=getCode();
}
document.write("<h3>验证码输入正确</h3>")
</script>