SOURCE

function writeDocument(variable) {
    document.write(variable + "<br/>");
}

writeDocument("生成随机验证码---------")

function generateVerifyCode(length){
    var strValue = "23193814jdskfsldkfjldsfjs";
    var code = "";

    for (var i =0; i < length;++i){
        var randomIndex = Math.floor(Math.random() * strValue.length);
        code += strValue.charAt(randomIndex);
    }
return code;
}

writeDocument(generateVerifyCode(4));
writeDocument(generateVerifyCode(5));
writeDocument(generateVerifyCode(6));
console 命令行工具 X clear

                    
>
console