1. Only allow numbers to be entered
<input name= "username" type= "text" onkeyup=
"Value=this.value.replace (/\d+/g, ')" >
2, only allowed to enter English letters, numbers and underscores (the following two ways to achieve)
<input name= "username" type= "text"
style= "ime-mode:disabled" >
<input name= "username" type= "text"
onkeyup= "Value=value.replace (/[^\w\.\/]/ig, ')" >
3, only allowed to enter English letters, numbers and =@#
<input name= "username" type= "text" onkeyup= "Value=value.replace (/[^\w=@#]|_/ig, ')" >
4, only allowed to enter Chinese characters
<input name= "username" type= "text" onkeyup=
"Value=value.replace (/[^\u4e00-\u9fa5]/g, ')" >
1. Only allow numbers to be entered
<input name= "username" type= "text" onkeyup=
"Value=this.value.replace (/\d+/g, ')" >
2, only allowed to enter English letters, numbers and underscores (the following two ways to achieve)
<input name= "username" type= "text"
style= "ime-mode:disabled" >
<input name= "username" type= "text"
onkeyup= "Value=value.replace (/[^\w\.\/]/ig, ')" >
3, only allowed to enter English letters, numbers and =@#
<input name= "username" type= "text" onkeyup=
"Value=value.replace (/[^\w=@#]|_/ig, ')" >
4, only allowed to enter Chinese characters
<input name= "username" type= "text" onkeyup= "Value=value.replace (/[^\u4e00-\u9fa5]/g, ')" >
Only numbers can be entered: "^[0-9]*$".
Only n digits can be entered: "^\d{n}$".
You can enter at least n digits: "^\d{n,}$".
You can enter only the number of m~n digits:. "^\d{m,n}$"
Only numbers beginning with 0 and not 0 can be entered: ^ (0|[ 1-9][0-9]*) $ ".
You can only enter positive real numbers with two decimal digits: ^[0-9]+ (. [ 0-9]{2})? $ ".
You can only enter positive real numbers with 1~3 decimal places: ^[0-9]+ (. [ 0-9]{1,3})? $ ".
You can only enter a Non-zero positive integer: "^\+?" [1-9] [0-9]*$].
You can only enter a Non-zero negative integer: "^\-[1-9][]0-9" *$.
You can only enter characters with a length of 3: "^. {3}$ ".
You can only enter a string of 26 English letters: "^[a-za-z]+$".
You can only enter a string consisting of 26 uppercase letters: "^[a-z]+$".
You can only enter a string consisting of 26 lowercase English letters: "^[a-z]+$".
You can only enter a string consisting of numbers and 26 English letters: "^[a-za-z0-9]+$".
You can only enter a string of numbers, 26 English letters, or underscores: "^\w+$".
Verify user password: "^[a-za-z]\w{5,17}$" is the correct format: start with a letter, length between 6~18, can only contain characters, numbers, and underscores.
Verify that there are ^%& ',; =?$\ ' and other characters: "[^%& ',; =?$\x22]+".
Only Chinese characters can be entered: "^[\u4e00-\u9fa5]{0,}$"
You can only enter numbers and decimal points, anti-paste:
<input type= "" "Text" onkeyup= "Value=value.replace (/[^0-9.] /g, '), Dxfqlld (); "Onpaste=" Value=value.replace (/[^0-9.] /g, "oncontextmenu=" Value=value.replace (/[^0-9.) /g, ")"/>