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="this.value=this.value.replace(//D/g,'')" onafterpaste="this.value=this.value.replace(//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(this.value)){alert('Only enter numbers'); this.value='';}">
3. Number and decimal point 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+(?:/./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+(?:/./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 enter letters and Chinese characters
<input onkeyup="value=value.replace(/[/d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').rep lace(/[/d] /g,''))" maxlength=10 name="Numbers">
5. Only enter English letters and numbers, not Chinese
<input onkeyup="value=value.replace(/[^/w/.//]/ig,'')">
6. Only enter numbers and English <font color="Red">chun</font>
<input onKeyUp="value=value.replace(/[^/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((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46 || //./d/d$/.test(value))event.returnValue=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="this.value=this.value.replace(/^(/-)*(/d+)/.(/d/d).*$/,'$1$2.$3')">
Only numbers and decimal points and addition, subtraction, multiplication
onkeypress="return event.keyCode>=4&&event.keyCode<=57"