随机验证码2(数组方法)
function getStr2() {
var str1 = '';
var str = 'qwertyuiopasdfghjklzxcvbnm0123456789QWERTYUIOPASDFGHJKLZXCVBNM';
var ary = [];//存放每一次生成的随机数
while(ary.length < 4){
var n = Math.round(Math.random()*61);
if(ary.indexOf(n) == -1){
ary.push(n);
str1 += str[n];
}
}
return str1;
}