The input box in html automatically switches the corresponding Chinese or English input method

Recently encountered a mobile terminal request, click the input box to switch the input method, record and summarize

 

Use a CSS non-standard ime-mode property, ime is the abbreviation of Input Method Editor. It is a specialized application for entering different characters representing the written languages ​​of East Asia.

 

grammar:

ime-mode : auto | active | inactive | disabled

 

 

Value:

(1) auto: the default value. Does not affect the status of ime. Same as when no ime-mode attribute is specified

(2) active : Specify all characters entered using ime. That is, the local language input method is activated. Users can still deactivate ime

(3) inactive: Specify all characters that are not input using ime. That is, non-native languages ​​are activated. Users can still deactivate ime

(4) disabled: completely disable ime. For controls with focus (such as input boxes), the user cannot activate ime

 

Compatibility: ime-mode is currently not supported by Safari/Chrome/Opera, because it is a mobile terminal so it is compatible. After the test is completed, come back and improve this article.

 

 

<input id="test1" name="test1" style="ime-mode:disabled">
<!--The first one is that the input method is not displayed, even if the keyboard cannot be used to switch the input method-->
<input id="test2" name="test2" style="ime-mode:active">
<!--The second one is an input method that automatically switches to English, but you can also use the keyboard to switch -->
<input id="test3" name="test3" style="ime-mode:inactive">
<!--The third one is to automatically switch to Chinese input method, but you can also use the keyboard to switch -->
<input id="test4" name="test4" style="ime-mode:auto">
<!--The fourth one is determined according to the current input method. If it is currently in English, it will display English, and if it is Chinese, then display Chinese -->

 

illustrate:

         Sets or retrieves whether to allow the user to activate the input method (ime) state for inputting Chinese, Korean, Japanese, etc.

         This property is read-only for currentstyle objects. For other objects can be read and written. The corresponding scripting feature is imemode.

 

Example: input {ime-mode: auto;}

         That's it. So when a text field does not require Chinese input, we can reduce the possibility of errors by setting the ime-mode attribute value to inactive or disabled. Similarly, we can set the ime-mode attribute value of the text fields that require Chinese input to active.

         Usually C/S business system, will pay attention to the control of the input method. The development of a business system based on B/S will definitely encounter the same problem, ime-mode believes that it can help. However, FireFox does not support this style sheet property.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326217153&siteId=291194637