首页 > 网站 > 建站经验 > 正文

Asp.NET!调用百度翻译的方法

2019-11-02 15:06:39
字体:
来源:转载
供稿:网友

 这篇文章主要介绍了Asp.NET调用百度翻译的方法,是针对百度接口开发的经典实用技巧,非常具有实用价值,需要的朋友可以参考下

  

本文实例讲述了Asp.NET调用百度翻译的方法。分享给大家供大家参考。具体分析如下:

Asp.NET调用百度翻译,如下图所示:

Asp.NET调用百度翻译的方法  电脑高手

HTML代码如下:

 

代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="baidu.aspx.cs" Inherits="FanYi_baidu" %>
<!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 runat="server">
<title>OA翻译</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="sourceWord" runat="server" Columns="50" Rows="15" style="width:100%;"
TextMode="MultiLine"></asp:TextBox>
<br />
源语言:<asp:DropDownList ID="ddlFrom" runat="server">
<asp:ListItem Value="auto">自动检测</asp:ListItem>
<asp:ListItem Value="zh">中文</asp:ListItem>
<asp:ListItem Value="en">英文</asp:ListItem>
<asp:ListItem Value="jp">日文</asp:ListItem>
</asp:DropDownList>
目标语言:<asp:DropDownList ID="ddlTo" runat="server">
<asp:ListItem Value="auto">自动检测</asp:ListItem>
<asp:ListItem Value="zh">中文</asp:ListItem>
<asp:ListItem Value="en">英文</asp:ListItem>
<asp:ListItem Value="jp">日文</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Translate"
runat="server" Text="翻译" onclick="Translate_Click" />
<br />
<asp:TextBox ID="resultText" runat="server" TextMode="MultiLine" Rows="15" Columns="50" style="width:100%;"></asp:TextBox>
</div>
</form>
</body>
</html>

 

C#代码如下:

 

代码如下:using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Runtime.Serialization;
using System.Runtime.Serialization
a67手机电影网[www.aikan.tv/special/a67shoujidianyingwang/]
.Json;
using System.Text;
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表