怎样在自己的网页中嵌入百度搜索功能
2010-01-28 13:45
459 查看
(1)*.aspx中的代码
<asp:TextBox ID="text1" Runat="server" Width="95px" Height="22" OnTextChanged="text1_TextChanged" ></asp:TextBox>
<asp:Button ID="btn" Text="百度搜索" Runat="server" Width="72px" Height="24" OnClick="btn_Click"></asp:Button>
(2)*.aspx.cs中的代码
protected void btn_Click(object sender, EventArgs e)
{
string texthere = text1.Text;
string searchtext = "http://www.baidu.com/s?wd=" + System.Web.HttpUtility.UrlEncode(texthere, System.Text.UnicodeEncoding.GetEncoding("GB2312")).ToUpper()
+ "&cl=3";
Response.Redirect(searchtext);
}
(3)相关解析
百度的编码:
str = System.Web.HttpUtility.UrlEncode("中文", System.Text.UnicodeEncoding.GetEncoding("GB2312")).ToUpper() ;
百度的解码:
System.Web.HttpUtility.UrlDecode("%C3%CF%CF%DC%BB%E1", System.Text.UnicodeEncoding.GetEncoding("GB2312"));
<asp:TextBox ID="text1" Runat="server" Width="95px" Height="22" OnTextChanged="text1_TextChanged" ></asp:TextBox>
<asp:Button ID="btn" Text="百度搜索" Runat="server" Width="72px" Height="24" OnClick="btn_Click"></asp:Button>
(2)*.aspx.cs中的代码
protected void btn_Click(object sender, EventArgs e)
{
string texthere = text1.Text;
string searchtext = "http://www.baidu.com/s?wd=" + System.Web.HttpUtility.UrlEncode(texthere, System.Text.UnicodeEncoding.GetEncoding("GB2312")).ToUpper()
+ "&cl=3";
Response.Redirect(searchtext);
}
(3)相关解析
百度的编码:
str = System.Web.HttpUtility.UrlEncode("中文", System.Text.UnicodeEncoding.GetEncoding("GB2312")).ToUpper() ;
百度的解码:
System.Web.HttpUtility.UrlDecode("%C3%CF%CF%DC%BB%E1", System.Text.UnicodeEncoding.GetEncoding("GB2312"));
相关文章推荐
- 网页嵌入百度搜索条(含站内搜索功能)
- 如何让自己的网页在百度中被搜索到
- 在自己的页面中嵌入百度搜索
- 在自己的网页中嵌入Google搜索且使该搜索在指定的网址中进行关键字搜索
- 怎样才能让百度,谷歌等收录自己的网页
- 百度搜索的代码,在自己的网页中添加百度搜索
- 在你的网站中嵌入搜索功能-百度和google
- 网页中嵌入百度搜索栏代码
- 网页中嵌入GOOGLE、百度搜索
- 如何制作一个简单的仿百度搜索功能的网页
- 怎样才可以让别人搜索到自己的网页 --
- 百度要革自己的命?移动搜索或取消PC网页收录
- 给自己的网页加入百度搜索
- 网页嵌入百度搜索,谷歌搜索下拉选择直接搜索
- 怎样让搜索引擎搜索到自己的网页
- 怎样在自己的网页中嵌入视频?
- 怎样才能让百度搜索到自己的csdn博客?
- 怎样才能让百度搜索到自己的博客?
- 在网页中嵌入百度、谷歌搜索(Web搜索与站内搜索)
- 网页中嵌入百度搜索栏代码