checkS = function(str){
// 判断字符串是否为数字和字母组合
var zg = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/;
if (!zg.test(str)) {
return false;
} else {
return true;
}
}
checkS = function(str){
// 判断字符串是否为数字和字母组合
var zg = /^[0-9a-zA-Z]*$/;
if (!zg.test(str)) {
return false;
} else {
return true;
}
}
两种方法,都可以,亲测成功。