It is very simple to add a property event:
<Asp: textbox class = "text"
Export nkeypress = "If (event. keycode <48 | event. keycode> 57) event. returnvalue = false ;"
Id = "txty_revenue" style = "text-align: Right" runat = "server" width = "90%" maxlength = "12">
</ASP: textbox>
Note: This method controls textbox to receive only numbers: 0 ~ 9
Provide an idea
Supplement:
1. The dotted box when the cancel button is pressed
Add the attribute value hidefocus or hidefocus = true in input.
2. Read-only text box content
Add the attribute value readonly in input.
3. Prevent text files from being cleared (style content can be referenced as a class)
<Input style = behav success or: URL (# default # savehistory); type = text id = opersistinput>
4. Press enter to move the cursor to the next input box.
<Input parameter nkeydown = "If (event. keycode = 13) event. keycode = 9">
5. It can only be Chinese (with flashing)
<Input parameter nkeyup = "value = value. Replace (/[-~] /G, '')" Export nkeydown = "If (event. keycode = 13) event. keycode = 9">
6. Only numbers are allowed (with flashing)
<Input parameter nkeyup = "value = value. replace (/[^ \ D]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^ \ D]/g, '')">
7. Only numbers are allowed (no flashing)
<Input style = "ime-mode: Disabled" Disable nkeydown = "If (event. keycode = 13) event. keycode = 9 "Export nkeypress =" If (event. keycode <48 | event. keycode> 57) event. returnvalue = false ">
8. Only English and numbers can be entered (with flashing)
<Input parameter nkeyup = "value = value. replace (/[\ W]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[^ \ D]/g, '')">
9. shielded Input Method
<Input type = "text" name = "url" style = "ime-mode: Disabled" Disable nkeydown = "If (event. keycode = 13) event. keycode = 9 ">
10. You can only enter numbers, decimal points, minus (-) characters (no flashing)
<Input parameter nkeypress = "If (event. keycode! = 46 & event. keycode! = 45 & (event. keycode <48 | event. keycode> 57) event. returnvalue = false ">
11. only two decimal places can be entered, and three decimal places (with flashing)