试试这个看行不行:
^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$ http://www.regexlib.com/DisplayPatterns.aspx?cattabindex=2&categoryId=3
^\$?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$ http://www.regexlib.com/DisplayPatterns.aspx?cattabindex=2&categoryId=3
你的也没满足“不能为0”,并且可以输入“0.”johnsuna(缘来是e)running_su(小曉)ern(毕业生)
你们的没有满足“不能为0”,怎么解决?
var reg=/^(([1-9]+[0-9]*)|(([1-9]{0,1}[0-9]{0,1}).[0-9]{1,2}))$/
function ftest()
{
alert(reg.test(textbox1.value))
}
</script>
<html>
<body>
<input id="textbox1" name="textbox1">
<input value="Test" type=button onclick="ftest()">
</body>
</html>