1. Text box can only enter numeric code ( Decimal point cannot be entered )
<input οnkeyup="this.value=this.value.replace(//D/g,'')"
onafterpaste="this.value=this.value.replace(//D/g,'')">

2. Only numbers can be entered , Can input decimal point .
<input οnkeyup="if(isNaN(value))execCommand('undo')"
onafterpaste="if(isNaN(value))execCommand('undo')">
<input name=txt1 οnchange="if(//D/.test(this.value)){alert(' Only numbers can be entered
');this.value='';}">

3. Number and decimal point method 2
<input type=text t_value="" o_value=""
οnkeypress="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"
οnkeyup="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"
οnblur="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 Chinese characters can be entered
<input οnkeyup="value=value.replace(/[/d]/g,'')
"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[/d]/g,''))"
maxlength=10 name="Numbers">

5. Only English letters and numbers can be entered , Cannot enter Chinese
<input οnkeyup="value=value.replace(/[^/w/.//]/ig,'')">

6. Only numbers and English can be entered <font color="Red">chun</font>
<input onKeyUp="value=value.replace(/[^/d|chun]/g,'')">

7. There can be no more than two decimal places ( number , Chinese can be input ), Letters and 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 be no more than two decimal places ( number , letter , Chinese can be input ), You can enter operation symbols :
<input
οnkeyup="this.value=this.value.replace(/^(/-)*(/d+)/.(/d/d).*$/,'$1$2.$3')">
 

Technology
©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )html Writing about cherry trees , Writing about cherry trees java Four functional interfaces ( a key , simple ) Browser kernel ( understand )06【 Interpretation according to the frame 】 Data range filtering -- awesome HashMap Explain in detail os Simple use of module computer network --- Basic concepts of computer network ( agreement , system ) Some East 14 Pay change 16 salary , Sincerity or routine ?