Assuming that the user's keyboard is set to a US English keyboard setting, is it possible to create an html text box with a button like "Vietnamese" that when clicked, will begin storing all user input as the Vietnamese keyboard input method?
For example, if I couple the button to the vietnamese-vni input method , and using my default US English keyboard, I typed: this is Vietnamese:
then I clicked the button, and typed tie4ng vie6t
, I want the text area to render this is Vietnamese: tiẽng viêt
I wonder if there is a way to do this in html/css/javascript?
It's not so simple to make your own script, but there is a library that does exactly what you want :
(function() { var txt = document.getElementById('vin'), btn = document.getElementById('change'), vin = false; VNTYPING.VNID = ['vin']; VNTYPING.SetMethod(0); btn.addEventListener('click', function() { vin = !vin; btn.textContent = vin ? 'ENG' : 'VIN'; VNTYPING.SetMethod(vin ? 1 : 0); txt.focus; }); })();
<script src="http://www.vntyping.com/vntyping.min.js"></script> <textarea id="vin"></textarea> <button id="change">VIN</button>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.