前台正则表达式匹配
前台正则表达式匹配:
前台正则表达式匹配
<scripttype="text/javascript">
//只能匹配整数,不包括小数点、字母、汉字等
functionchecknums(theform){
if(!/^\d{5,9}$/.test(theform.value)){
returnfalse;
}
returntrue;
}
//浮点数匹配
functionchecknum(theform){
if(!/^(-?\d+)(\.\d+)?$/.test(theform.qq.value)){
returnfalse;
}
returntrue;
}
//只能匹配英文字符、数字
functionchecknum(theform){
if(!/^[A-Za-z0-9]+$/.test(theform.qq.value)){
returnfalse;
}
returntrue;
}
//只能匹配英文字符、中文字符、数字
functionchecknum(theform){
if(!/^[\u4e00-\u9fa5A-Za-z0-9]+$/.test(theform.qq.value)){
returnfalse;
}
returntrue;
}
</script>
</script>
<formaction=""method="get"onsubmit="returnchecknum(this)">QQ:<inputname="qq"
type="text"/><inputname=""type="submit"value="提交">
</form>相关推荐
wangzhaotongalex 2020-10-20
wyq 2020-11-11
TLROJE 2020-10-26
风雨断肠人 2020-10-13
duanqingfeng 2020-09-29
rechanel 2020-11-16
cshanzhizi 2020-10-16
luofuIT成长记录 2020-09-22
phphub 2020-09-10
taomengxing 2020-09-07
MaggieRose 2020-08-19
flyingssky 2020-08-18
山水沐光 2020-08-18
jyj00 2020-08-15
AHuqihua 2020-08-09
山水沐光 2020-08-03