搜狗云输入法对外提供调用体验
无意看到这个搜狗云输入法,提供对外调用,以下代码是个例子,不错哈。。。。。。
实现原理就是把您敲击的键实时传到远程服务器上去进行查讯,返回查讯结果。
[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>搜狗云输入法domo</title>
</head>
<body>
<h1>搜狗云输入法domo</h1>
<input type="text" onfocus="txtAreaClick(this)"/>
<pre>
<code>
function txtAreaClick(oTxtArea){
oTxtArea.value="";
oTxtArea.style.color = "#000";
try{
if(ime_close)return;
}
catch(e){
var ele=document.createElement('script');
ele.setAttribute('src','http://web.pinyin.sogou.com/web_ime/init.js');
document.body.appendChild(ele);
}
}
</code>
</pre>
<SCRIPT type="text/javascript">
function txtAreaClick(oTxtArea){
oTxtArea.value="";
oTxtArea.style.color = "#000";
try{
if(ime_close)return;
}
catch(e){
var ele=document.createElement('script');ele.setAttribute('src','http://web.pinyin.sogou.com/web_ime/init.js');document.body.appendChild(ele);
}
}
</SCRIPT>
</body>
</html>
[/html]