Change the ime model by JS)

Source: Internet
Author: User
Qustion:

I am using a web application input page where the user enters name in English from SQL table and upon pressing tab on the English name I am displaying the name in different language in another textbox that has direction from right to left. some times I need to enter names that are not found in the database. in this case, I need when pressing tab from the English name; to change the RTL ction (RTL) And language (Ar-sa) in the second name automatically without the user pressing right Alt + shift to change the direction and language. Is this possible with a JavaScript or CSS? Thanks

My answer 1:
I think the imemode of CSS can do this
Pls. Try the following code, hope this helps:

Onfocus = "This. style. imemode = 'Disabled '"

Auto: IME is not affected. This is the same as not specifying the ime-mode attribute.
Active: All characters are entered through the ime. Users can still deactivate the ime.
Inactive: All characters are entered without ime. Users can still activate the ime.
Disabled: IME is completely disabled. Users cannot activate the ime if the control has focus.

My answer 2:

1. Declare API functions:

Functionbooleanimmsimulatehotkey (ulonghwnd, ulongdwhotkeyid) Library "imm32.dll"

Functionulonggetkeyboardlayout (ulongdwlayout) Library "user32.dll"

Functionbooleanimmisime (ulonghklkeyboardlayout) Library "imm32.dll"

2. DeclareVariable:

Constantintime_thotkey_ime_nonime_toggle = 112

Ulonghklcurrent

Ulonghnd

3. Change to English:

Hklcurrent = getkeyboardlayout (0)

Ifimmisime (hklcurrent) then

HND = handle (parent)

Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)

Endif

4. Change to other language:

Hklcurrent = getkeyboardlayout (0)

Ifnotimmisime (hklcurrent) then

HND = handle (parent)

Immsimulatehotkey (HND, ime_thotkey_ime_nonime_toggle)

Endif

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.