1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<! 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 > |