Input=text Digital Issues

Source: Internet
Author: User

In fact, old cadres will also make mistakes, today's friends in the bank card account when asked to enter the number, it is actually excluding Chinese. In fact, the regular is very important. Say less nonsense. What if I forbid Chinese?

    • Ime-mode

But this method of compatibility is not very good, first we need to know.

The Ime-mode of CSS
Grammar:
Ime-mode:auto | active | Inactive | Disabled
Value:
Auto: Default value. Does not affect the state of the IME. Same as do not specify Ime-mode property
Active: Specifies all characters that are entered using the IME. The local language input method is activated. Users can still revoke the activation IME
Inactive: Specifies all characters that do not use IME input. The non-native language is activated. Users can still revoke the activation IME
Disabled: Disables the IME entirely. The user cannot activate the IME for a control that has focus (such as an input box)

Description: Sets or retrieves whether the user is allowed to activate Input Method (IME) status in Chinese, Korean, Japanese, and so on. This property is read-only for Currentstyle objects. Readable and writable for other objects. The corresponding script attribute is IMEMode.

That's it. So when a text field does not require Chinese input, we can reduce the likelihood of errors by setting the Ime-mode property value to inactive or disabled. Similarly, we can set the Ime-mode property value of the text field that requires Chinese input to active.
Usually the business system of C/s, will pay attention to input method control problems. Development based on B/S business system, will also encounter the same problem, Ime-mode believe can help. However, FireFox does not support this style sheet property.

    • Regular validation

Direct text Verification, many people like to listen to the keyboard, judge the keyboard code, test, a bit of a problem, such as Sogou Chinese input, if you hit a long list of Chinese, finally select the number, determine which string. Listening events cannot be monitored. Our best way is to listen to text, text listening to the end of the listening keyboard when the event onkeyup, the text must also be full text scanning '/g ', which is a lot of the initial use of the regular said easy to forget. Here's the simplest way to do it.

<type= "text"  style= "ime-mode:disabled"       onkeyup  = "This.value=this.value.replace (/[^\d]/g, ')"/>

  

  

Input=text Digital Issues

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.