function check()
{
var txt = document.f1.num.value;
var pattern=/^/d{2,20}$/; //输入2到20位的数字
if(!pattern.exec(txt))
{
alert("请输入大于一位的数字!");
document.f1.num.focus();
return false;
}
}
正则表达式在js中说的
最新推荐文章于 2024-08-10 06:13:02 发布
function check()
{
var txt = document.f1.num.value;
var pattern=/^/d{2,20}$/; //输入2到20位的数字
if(!pattern.exec(txt))
{
alert("请输入大于一位的数字!");
document.f1.num.focus();
return false;
}
}