<!
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
>