JS Limits the implementation code for the input box input

  • 的头像-Tumi
  • 36 day agopublish

1. The text box can only enter digital code (decimal point can not be entered)

The code is as follows:

2. Can only input numbers, can output a number of points.

The code is as follows:

     3. Digital and decimal point method 2 
The code is as follows:

4. Can only input letters and Chinese characters

5. Can only input English letters and numbers, not The code is as follows:

   6. Can only enter numbers And English  Font Color = "Red"> chun 

   7. There can only be up to two (numbers, Chinese) after the decimal point (numbers, Chinese can not enter letters and arithmeters:  
code As shown in:

< 57) && event.keycode! = 46 || /\.\d @Test(Value) Event.RETurnValue = false ">

8. There can be only two digits (numbers, letters, Chinese can be entered) after the decimal point can enter the operation symbol:

   // can only input Chinese characters:  // can only enter numbers: 
/ / Can only enter English and numbers: // Control the input box can only enter text or numbers, or you may not allow input for special characters // This is not allowed to enter the following characters: (like! @ # $% ^ & *, Etc.
32 && event.keycode

57 && event.keycode // only disable space input onkeyup = “value = value.replace (/ \ s / g, ”) “// can only enter Chinese and English: onkeyup =” value = value.replace (/ [^ \ A-ZA-Z \ U4E00- \ U9FA5] / g, ”) “OnBeforePaste =” ClipboardData .SetData (‘Text’, ClipboardData.Getdata (‘Text’). Replace (/ [^ \ A-ZA-Z \ U4E00- \ U9FA5] / g, ”) “

  <input onKeyPress="if((event.keyCode The above is the implementation code input to the JS limit input box input to everyone, I hope that everyone has any questions. Please leave a message, the small package will reply to everyone in time. Thank you very much for your support for Tumi Cloud Website!  
© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment