正则表达式在js中说的

来源:互联网 发布:浙江大学网络认证系统 编辑:程序博客网 时间:2024/05/29 03:15

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;
}
}

原创粉丝点击