Mask text box

Source: Internet
Author: User

1. text box only Yes enter Number Code (decimal point cannot be entered)

2. only Yes enter Number , Yes enter the decimal point .

only
Yes enter Number '); this. value = '';}">

3. Number and decimal point method 2

4.OnlyYesEnter letters and Chinese characters
<Input onkeyup = "value = value. replace (/[/d]/g, '')" onbeforepaste = "clipboardData. setdata ('text', clipboardData. getdata ('text '). replace (/[/d]/g, '')" maxlength = 10 name = "Numbers">

5.OnlyYesEnter English letters andNumberCannot enter Chinese Characters
<Input onkeyup = "value = value. Replace (/[^/W/. //]/ig,'') ">

6.OnlyYesInputNumberAnd English <font color = "red"> Chun </font>
<Input onkeyup = "value = value. Replace (/[^/d | Chun]/g,'') ">

7. After decimal pointOnlyYesThere can be a maximum of two (Number, Can be entered in Chinese), cannot enter letters and operator number:
<Input onkeypress = "If (event. keycode <48 | event. keycode> 57) & event. keycode! = 46 | //./D/d $/. Test (value) event. returnvalue = false ">

8. After decimal pointOnlyYesThere can be a maximum of two (Number, Letters, Chinese characters), can enter the operator number:
<Input onkeyup = "this. value = This. value. replace (/^ (/-) * (/d + )/. (/D/d ). * $/, '$1 $2. $ 3') ">

 

No replacement method. Only numbers are allowed.

Onkeypress = "keyhandle"

Function Keyhandle () {
If (Event. keycode < 48 | Event. keycode > 57 ) {
Event. returnvalue= False;
}  
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.