判断数字合法性的正则表达式

来源:互联网 发布:arraysplice php 编辑:程序博客网 时间:2024/04/29 08:16
function NumberCheck(num) 
 {
  var re=/^\d*\.{0,1}\d{0,1}$/;
  return re.exec(num) != null;

 }

if (!NumberCheck(oInput1.value))
  {
   alert("格式不对");
  }else{
   alert("格式正确");
  }

0 0
原创粉丝点击