01

google翻译的api实在是强大。下面是一个简单的api示例:

在这个简单示例的基础上可以弄出不少东东呢,嘿嘿。 更详细说明

<!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 – Basic Translation</title>
<script type=”text/javascript” src=”//www.google.com/jsapi”></script>
<script type=”text/javascript”>

google.load(“language”, “1″);

function initialize() {
google.language.translate(“Hello world”, “en”, “es”, function(result) {
if (!result.error) {
var container = document.getElementById(“translation”);
container.innerHTML = result.translation;
}
});
}
google.setOnLoadCallback(initialize);

</script>
</head>

<body>
<div id=”translation”></div>
</body></html>

1条评论 于 “在您的网页上添加 Google AJAX 语言 API”

添加评论