<!
doctype
html>
<
html
lang="en">
<
head
>
<
meta
charset="UTF-8">
<
meta
name="Generator" content="EditPlus®">
<
meta
name="Author" content="">
<
meta
name="Keywords" content="">
<
meta
name="Description" content="">
<
title
>Document</
title
>
</
head
>
<
body
>
<
script
type="text/javascript">
var reg = /(^[1-9]([0-9]+)?(.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9].[0-9]([0-9])?$)/;
var money = "520.100";
//000 错
//0 对
//0. 错
//0.0 对
//050 错
//00050.12错
//70.1 对
//70.11 对
//70.111错
//500 正确
if (reg.test(money)) {
alert("正确~");
}else{
alert("有误~");
};
</
script
>
</
body
>
</
html
>