Js代码:
/**
* 验证码
*/
function yzm(){
var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,’z’,
‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’, ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’);
var code=””;
for(var i = 0;i < 4;i++)
{
var charNum = Math.floor(Math.random() * 52);
code += codeChars[charNum];
}
document.getElementById(“yzphoto”).value=code;
document.getElementById(“yzm”).value=code;
}
HTML代码:
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!