<html>
<head>
<title>欢迎光临耗子工作室</title>
<script type="text/javascript" src="
http://www.google.com/jsapi"></script>
<script type="text/javascript"
src="
http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>

<script type="text/javascript">
google.load("language", "1");
function initialize() {
var text = $("#text").val();
google.language.detect(text, function(result) {
   if (!result.error && result.language) {
    google.language.translate(text, result.language, "ja",
      function(result) {
       var translated = document
         .getElementById("translation");
       if (result.translation) {
        translated.innerHTML = result.translation;
       }
      });
   }
});
}
$(function(){
$("#begin").click(function() {
   initialize();
   return false;
});
});
</script>
<style type="text/css">
<!--
.STYLE1 {
color: #6600CC;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div class="STYLE1">
欢迎使用耗子中日翻译程序</div>
<div>
<input id="text" type="text" value="你好,很高兴认识你" />
</div>
<div id="translation"></div>
<div><a id="begin" href="#">翻译</a></div>
</body>
</html>

 posted on 2010-09-07 10:59  纳米程序员  阅读(2234)  评论(0编辑  收藏  举报