1, the text box can only enter a numeric code (the decimal point can not be entered)
<input onkeyup="this.value=this.value.replace (/\d/g, ')" onafterpaste=" This.value=this.value.replace (/\d/g, ") ">
2, only the number can be entered, the decimal point will be lost.
<input onkeyup="if (IsNaN (value)) ExecCommand (' Undo ')" onafterpaste="if (IsNaN (value)) ExecCommand (' Undo ')"><input name=txt1 onchange="if (/\d/.test ( This.value) {alert (' Input number only '); this.value= ';} ">
3, digit and decimal method two
<input Type=text t_value=""O_value=""onkeypress="if (!this.value.match (/^[\+\-]?\d*?\.? \d*?$/)) This.value=this.t_value;else this.t_value=this.value;if (This.value.match (?: [/^ (?: \. \d+)?)? $/)) This.o_value=this.value"onkeyup="if (!this.value.match (/^[\+\-]?\d*?\.? \d*?$/)) This.value=this.t_value;else this.t_value=this.value;if (This.value.match (?: [/^ (?: \. \d+)?)? $/)) This.o_value=this.value"Onblur="if (!this.value.match/^ (?: [\+\-]?\d+ (?: \. \d+)? | \.\d*?)? $/) this.value=this.o_value;else{if (This.value.match (/^\.\d+$/)) this.value=0+this.value;if (This.value.match (/^ \.$/)) This.value=0;this.o_value=this.value}">
4, only letters and kanji can be entered
<input onkeyup=""onbeforepaste="clipboarddata.setdata (' text ', Clipboarddata.getdata (' text '). Replace (/[\d]/g, ')" maxlength= name= " Numbers">
5, can only input English letters and numbers, cannot input Chinese
<input onkeyup="value=value.replace (/[^\w\.\/]/ig, ')">
6, can only enter numbers and English
<input onkeyup="value=value.replace (/[^\d|chun]/g, ')">
7, only a maximum of two digits after the decimal point (numbers, Chinese can be entered), can not enter letters and operation symbols:
<input onkeypress="if (event.keycode<48 | | event.keycode>57) && event.keycode!=46 | | /\.\d\d$/.test (value)) Event.returnvalue=false">
8, only a maximum of two digits after the decimal point (numbers, letters, Chinese can be entered), you can enter the operation symbol:
<input onkeyup="this.value=this.value.replace (/^ (\-) * (\d+) \. ( \d\d). *$/, ' $1$2.$3 ')">
Some small verification of JS