Recently, sogou launched the so-called cloud input method (http://pinyin.sogou.com/cloud)
Sogou's online input method is just a little tricky. It is also called "Cloud ".
The implementation method is simple. Let your browser execute a Javascript script.
Javascript: Void (( Function (){ VaR % 20n = Navigator. useragent. tolowercase (); IE = N. indexof ( ' MSIE ' ) ! =- 1 ? 1 : 0 ; If (Document.doc umentmode) IE = 0 ; Charset = '' ; If (IE) charset = Document. charset; SRC = IE && Charset = ' UTF-8 ' ? ' Http://web.pinyin.sogou.com/web_ime/init2_utf8.php ' : ' Http://web.pinyin.sogou.com/web_ime/init2.php ' ; Element = Document. createelement ( ' Script ' ); Element. setattribute ( ' SRC ' , Src); document. Body. appendchild (element );})())
After executing this section of JS, the current web page you browse will appear. The so-called "Cloud" input method is displayed.
In fact, a script tag is dynamically generated from the current page body through Js. the src attribute of the script tag is the address of the page to be called. A script element is generated after initialization. then, I used Ajax technology to interact with the server. in this way, you can input a letter, and then return the Chinese characters from the server to give you a selection.
We canCodeFor use.
< Script Type = " Text/JavaScript " >
Function Hooyesdoit (){
VaR N = Navigator. useragent. tolowercase ();
IE = N. indexof ( ' MSIE ' ) ! =- 1 ? 1 : 0 ;
If (Document.doc umentmode) IE = 0 ; Charset = '' ;
If (IE) charset = Document. charset;
SRC = IE && Charset = ' UTF-8 ' ? ' Http://web.pinyin.sogou.com/web_ime/init2_utf8.php ' : ' Http://web.pinyin.sogou.com/web_ime/init2.php ' ;
Element = Document. createelement ( ' Script ' );
Element. setattribute ( ' SRC ' , Src );
Document. Body. appendchild (element );}
< / SCRIPT>
Compile a js method and call it with a button.