JS judgment can only be a number and a decimal point (excerpted from other information, published here only for personal use and searching in the future)
1. Only numbers can be entered in the text box (excluding decimal points)
<input onkeyup="=(/\D/g,'')" onafterpaste="=(/\D/g,'')">
2. Only numbers and decimal points can be entered.
<input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')">
<input name=txt1 onchange="if(/\D/.test()){alert('Only enter numbers');='';}">
3. Number and decimal point method two
<input type=text t_value="" o_value="" onkeypress="if(!(/^[\+\-]?\d*?\.?\d*?$/))=this.t_value;else this.t_value=;if((/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=" onkeyup="if(!(/^[\+\-]?\d*?\.?\d*?$/))=this.t_value;else this.t_value=;if((/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=" onblur="if(!(/^(?:[\+\-]?\d+(?:\.\d+)?|\.\d*?)?$/))=this.o_value;else{if((/^\.\d+$/))=0+;if((/^\.$/))=0;this.o_value=}">
4. Only enter letters and Chinese characters
<input onkeyup="value=(/[\d]/g,'') "onbeforepaste="('text',('text').replace(/[\d]/g,''))" maxlength=10 name="Numbers">
5. Only enter English letters and numbers, not Chinese
<input onkeyup="value=(/[^\w\.\/]/ig,'')">
6. Only enter numbers and English <font color="Red">chun</font>
<input onKeyUp="value=(/[^\d|chun]/g,'')">
7. There can only be up to two digits after the decimal point (numbers and Chinese can be entered), and letters and operator symbols cannot be entered:
<input onKeyPress="if((<48 || >57) && !=46 || /\.\d\d$/.test(value))=false">
8. There can only be up to two digits after the decimal point (numbers, letters, and Chinese), and operator symbols can be entered:
<input onkeyup="=(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
Only numbers and decimal points and addition and subtraction
onkeypress="return >=4&&<=57"
1. Only numbers can be entered in the text box (excluding decimal points)
<input onkeyup="=(/\D/g,'')" onafterpaste="=(/\D/g,'')">
2. Only numbers and decimal points can be entered.
<input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')">
<input name=txt1 onchange="if(/\D/.test()){alert('Only enter numbers');='';}">
3. Number and decimal point method two
<input type=text t_value="" o_value="" onkeypress="if(!(/^[\+\-]?\d*?\.?\d*?$/))=this.t_value;else this.t_value=;if((/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=" onkeyup="if(!(/^[\+\-]?\d*?\.?\d*?$/))=this.t_value;else this.t_value=;if((/^(?:[\+\-]?\d+(?:\.\d+)?)?$/))this.o_value=" onblur="if(!(/^(?:[\+\-]?\d+(?:\.\d+)?|\.\d*?)?$/))=this.o_value;else{if((/^\.\d+$/))=0+;if((/^\.$/))=0;this.o_value=}">
4. Only enter letters and Chinese characters
<input onkeyup="value=(/[\d]/g,'') "onbeforepaste="('text',('text').replace(/[\d]/g,''))" maxlength=10 name="Numbers">
5. Only enter English letters and numbers, not Chinese
<input onkeyup="value=(/[^\w\.\/]/ig,'')">
6. Only enter numbers and English <font color="Red">chun</font>
<input onKeyUp="value=(/[^\d|chun]/g,'')">
7. There can only be up to two digits after the decimal point (numbers and Chinese can be entered), and letters and operator symbols cannot be entered:
<input onKeyPress="if((<48 || >57) && !=46 || /\.\d\d$/.test(value))=false">
8. There can only be up to two digits after the decimal point (numbers, letters, and Chinese), and operator symbols can be entered:
<input onkeyup="=(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')">
Only numbers and decimal points and addition and subtraction
onkeypress="return >=4&&<=57"