To make the project more user-friendly, do not use alert to bring up message prompts and prompt users to input errors when entering values in the text box. Therefore, only the characters entered by the user can be controlled to prevent errors. The following is a simple verification function: <br/> verify the integer <br/> <input type = "text" onkeyup = "this. value = This. value. replace (// D/g ,''); "/> <br/> verify decimals <br/> <SCRIPT type =" text/JavaScript "> <br/> string. prototype. replaceall = function (S1, S2) {<br/> return this. replace (New Regexp (S1, "GM"), S2); // G Global <br/>}</P> <p> function validdecimal (C, Val) {<br/> If (parsefloat (VAL )! = Val) {<br/> var AR = Val. split (''); <br/> for (VAR I = 0; I <ar. length; I ++) {<br/> var charcode = ar [I]. charcodeat (0); <br/> If (charcode> 57 | charcode <46 | charcode = 47) {<br/> C. value = Val. replaceall (AR [I], ''); <br/>}< br/> </SCRIPT> <br/> <input type = "text" onkeyup = "validdecimal (this, this. value); "/>