Loading...

java .net

google ajax 翻译

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google AJAX Language API - Hello World</title>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">

    google.load("language", "1");

    function initialize(str) {
      var text = document.getElementById("text").value;
      google.language.detect(text, function(result) {
        if (!result.error && result.language) {
   google.language.translate(text, result.language, str,
                             function(result) {
     var translated = document.getElementById("translation");
     if (result.translation) {
       translated.innerHTML = result.translation;
            }
          });
        }
      });
    }
    google.setOnLoadCallback(initialize);

    </script>
</head>
<body>
    <input type="text" name="text" value="你好,很高��到你。"/>
<input type="button" value="汉译英" onclick="javascript:initialize('en')"/>
<input type="button" value="英译汉" onclick="javascript:initialize('zh')"/>
    <div id="translation"></div>
</body>
</html>

posted on 2008-08-26 22:07 阅读(135) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

公告

希望有一天

我能用鼠标双击我的钱包

然后选中一张100元

按住“ctrl+c”

接着不停的“ctrl+v”

嘻嘻~~~笑醒~~~



导航

<2008年8月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456

统计

常用链接

留言簿(6)

随笔分类(102)

随笔档案(398)

文章分类

文章档案(10)

有趣网络

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜