JS control text box can only enter numbers
<input onkeyup= "Value=value.replace (/[^0-9]/g,") "Onpaste=" Value=value.replace (/[^0-9]/g, "") "OnContextMenu =" Value=value.replace (/[^0-9]/g, ")" >
JS control text box can only enter numbers, decimal points
<inputonkeyup= "Value=value.replace (/[^\0-9\.) /g, "onpaste=" Value=value.replace (/[^\0-9\.) /g, "oncontextmenu =" value=value.replace (/[^\0-9\.) /g, ') ' >
JS control text box can only be entered in English
<inputonkeyup= "Value=value.replace (/[^\a-\z\a-\z]/g,") "Onpaste=" Value=value.replace (/[^\a-\z\A-\Z]/g, ' ")" OnContextMenu = "Value=value.replace (/[^\a-\z\a-\z]/g, ')" >
JS control text box can only be entered in English, digital
<inputonkeyup= "Value=value.replace (/[^\a-\z\a-\z0-9]/g,") "Onpaste=" Value=value.replace (/[^\a-\z\A-\Z0-9]/g , '] "oncontextmenu=" Value=value.replace (/[^\a-\z\a-\z0-9]/g, ")" >
JS control text box can only input Chinese
<inputonkeyup= "Value=value.replace (/[^\u4e00-\u9fa5]/g,") "Onpaste=" Value=value.replace (/[^\u4E00-\u9FA5]/g , '] "oncontextmenu=" Value=value.replace (/[^\u4e00-\u9fa5]/g, ")" >
JS control text box can only input Chinese, English, digital
<inputonkeyup= "Value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5]/g,") "Onpaste=" Value=value.replace (/[^\a- \z\a-\z0-9\u4e00-\u9fa5]/g, "oncontextmenu =" value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5]/g, ') ">
JS control text Box can only enter Chinese, English, numerals, spaces
<inputonkeyup= "Value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5\]/g,") "Onpaste=" Value=value.replace (/[^\ a-\z\a-\z0-9\u4e00-\u9fa5\]/g, "oncontextmenu =" Value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5\]/g, ")" >
JS control text box can only input Chinese, English, numerals, decimal points
<inputonkeyup= "Value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5\.) /g, "onpaste=" Value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5\.) /g, "oncontextmenu =" value=value.replace (/[^\a-\z\a-\z0-9\u4e00-\u9fa5\.) /g, ') ' >
Word:
First enter in ' <input> '
Onkeyup= "Value=value.replace (/[^\x]/g,") "
Then replace the X in (/[\x]/g, "") with the code you want to enter,
Chinese u4e00-u9fa5, number 0-9, English a-z\a-z, other symbol @, dot or other symbol.
can also be multiple, separated on the line.
For example: Chinese and English + digit + @ symbol + dot symbol \a-\z\a-\z0-9\u4e00-\u9fa5\@\.
If you want to be in a text box can not right-click pop-up menu and can not paste into the copied information
You must enter onpaste= in ' <input> ' return false ' oncontextmenu= ' return false;
The above JS control text box can only input Chinese, English, digital and designated special symbols of the implementation code is small set to share all the content, hope to give you a reference, also hope that we support cloud habitat community.