仿Google翻译 中--->英
来源:互联网 发布:连接sqlserver数据库 编辑:程序博客网 时间:2024/05/17 06:37
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>
<title>simple translator</title>
<script type="text/javascript" src="https://www.google.com/jsapi?key=AIzaSyBn_f4BjfZU1AoJxqe5Bs-Bd_j-HMweksA"></script>
</head>
<script type="text/javascript">
google.load("language", "1");
function translate_for_me( ){
var text = document.getElementById("text_box").value;
google.language.translate(text, 'ch', 'en', callback_function);
}
function callback_function(result) {
var translated = document.getElementById("translation");
if (result.translation) {
translated.innerHTML = result.translation;
} else {
translated.innerHTML = "无翻译结果";
}
}
</script>
<body>
<form id="form1" runat="server">
<input type="text" id='text_box' runat="server"/>
<input type='button' onclick="translate_for_me()" value='translate_js'/>
<asp:Button ID="Button3" runat="server" Text="translate_c#" onclick="Button3_Click" />
</br>
<div id="translation"></div>
</form>
</body>
</html>
后台:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
}
}
protected void Button3_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(Page, this.GetType(), "myscript", "translate_for_me('ce');", true);
}
}
- 仿Google翻译 中--->英
- GOOGLE中英翻译
- google 翻译
- 【翻译】仿射变换
- 【翻译】仿射变换
- 仿google查询效果
- 仿google导航效果
- 仿Google建议效果
- 仿google分页实例
- 仿google输入框
- 如何仿google下拉
- 仿GOOGLE分页
- 仿Google搜索框
- 仿Google地图Tooltip
- 仿google分页
- 仿google分页
- 仿google搜索提示
- 仿google分页
- smartform 中currency 字段的小数点问题
- 用Visual C#实现端口监听模拟即时通讯
- mysql的insert into from select 和update by select
- linux中shell变量
- 人体必须清除的12种毒素
- 仿Google翻译 中--->英
- select 控件js
- Fusioncharts的数字格式化
- null值判断的一个避免错误
- [Excel VBA] 如何根据单元格的值跳转到另一工作表有相同值的单元格?
- Android中Message机制的灵活应用
- DIV+CSS解决IE6,IE7,IE8,FF兼容问题
- 嵌入式系统PCB设计中的阻抗匹配与0欧电阻
- 关于CXF的FrontEnd和数据绑定方案