How JavaScript disables keypad input numbers

Source: Internet
Author: User

How JavaScript prevents the keypad from entering numbers:
Do not know why to prohibit the keypad input numbers, but there is a need, but it is also very simple, is simply through the key code to determine whether the keypad is pressed, the following directly see the code, code examples are as follows:

functionIsnum ()//determine the keypad input number{   varStr=(Window.event.keyCode); if(str>105 | | str<96 )   {     if(str!=8) {Window.event.returnValue=false; return; }   } } functionIsnumup ()//determine the main keyboard input number{   varStr=(Window.event.keyCode); if(str>57 | | str<48 )   {     if(str!=8) {Window.event.returnValue=false; return; }   } } 

The above code can determine whether to use the keypad input numbers, here is not more introduced, it is easy to see.
You can refer to the JS keyboard key KeyCode property value corresponding to the table section.

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=9260

For more information, refer to: http://www.softwhy.com/javascript/

How JavaScript disables keypad input numbers

Related Article

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.