JS正则表达式检验数字或者带小数点的数字
1.
var patrn = /^\d+(\.\d+)?$/;
var num = 0.11;
if (!patrn.exec(num)){
alert("请您输入数字");return;
}
2.
var patten = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
var num = 0.11;
if(!patten.test(num)){
alert("请您输入数字");return;
}