请输入5至10个字元的小写英文字母,数字,以及_符号,第一个字元需为英文字母
用javascript代码
谢谢
2 个解决方案
#1
<script>
function check(){
var filter=/^\s*[.A-Za-z0-9_-]{5,10}\s*$/;
if (!filter.test(document.reg.username.value)) {
alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
document.reg.username.focus();
document.reg.username.select();
return false;
}
}
</script>
function check(){
var filter=/^\s*[.A-Za-z0-9_-]{5,10}\s*$/;
if (!filter.test(document.reg.username.value)) {
alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
document.reg.username.focus();
document.reg.username.select();
return false;
}
}
</script>
#2
解释一下程序可以吗reg.username 什么东东 我换成我的form1.textfield 也不行哦
#1
<script>
function check(){
var filter=/^\s*[.A-Za-z0-9_-]{5,10}\s*$/;
if (!filter.test(document.reg.username.value)) {
alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
document.reg.username.focus();
document.reg.username.select();
return false;
}
}
</script>
function check(){
var filter=/^\s*[.A-Za-z0-9_-]{5,10}\s*$/;
if (!filter.test(document.reg.username.value)) {
alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。");
document.reg.username.focus();
document.reg.username.select();
return false;
}
}
</script>
#2
解释一下程序可以吗reg.username 什么东东 我换成我的form1.textfield 也不行哦