云水论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3331|回复: 2
打印 上一主题 下一主题

[转帖]百度搜索引擎代码,谷歌搜索引擎代码

[复制链接]

1788

主题

62

好友

8525

积分

管理员

Rank: 9Rank: 9Rank: 9

跳转到指定楼层
楼主
发表于 2009-12-30 23:06:20 |只看该作者 |倒序浏览

网络推广   2009-05-22 11:23   阅读380   评论0   字号: 大大  中中  小小 1.将以下代码粘贴到您希望放置的网页中:
google搜索代码:
<form method=get action="http://www.google.com/search">
<table width="93%" bgcolor="#EFEFEF">
<tr><td width="90%">
<a href="http://www.google.cn/"><imgsrc="images/logo-1.gif" alt="google" align="bottom" border="0"></a>
<input type=text name=q size="30">
<input type="submit" value="谷歌搜索">
<input type=hidden name=ie value=GB2312>
<input type=hidden name=oe value=GB2312>
<input type=hidden name=hl value=zh-CN>
</td>
</tr></table>
</form>
百度搜索代码:
<form action="http://www.baidu.com/stn=piaojian" target="_blank">
<table width="93%" bgcolor="#EFEFEF">
<tr><td width="90%">
<input name=tn type=hidden value=piaojian>
<a href="http://www.baidu.com/"><imgsrc="images/logo-80px.gif" alt="Baidu" align="bottom" border="0"></a>
<input type=text name=word size=30>
<input type="submit" value="百度搜索">
</td>
</tr></table>
</form>
雅虎搜索代码:
<form method=get action="http://www.google.com/search">
<table width="93%" bgcolor="#EFEFEF">
<tr><td width="90%">
<a href="http://www.google.cn/"><imgsrc="images/logo-1.gif" alt="google" align="bottom" border="0"></a>
<input type=text name=q size="30">
<input type="submit" value="谷歌搜索">
<input type=hidden name=ie value=GB2312>
<input type=hidden name=oe value=GB2312>
<input type=hidden name=hl value=zh-CN>
</td>
</tr></table>
</form>
下面是Google和百度的Javascript版的站内搜索代码:
<!--Google站内搜索开始-->
<script. type="text/javascript">
function googlesearch () {
var wq=document.getElementsByName("wq")[0].value;
var link="http://www.google.com/searchdomains=www.cnw.com.cn&sitesearch=www.cnw.com.cn&q="+wq;
window.open(link); }
</script>
<input type="text" name="wq"/><input type="submit" nclick="javascript.:googlesearch()" value="Google 搜索" />
<!--Google站内搜索结束-->
<!--Baidu站内搜索开始-->
<script. language="javascript">
function baidusearch () {
var wd=document.getElementsByName("wd")[0].value;
var link="http://www.baidu.com/ssi=www.cnw.com.cn&cl=3&ct=2097152&tn=baidulocal&word="+wd;
window.open(link); }
</script>
<input type="text" name="wd"/><input type="submit" nclick="javascript.:baidusearch()" value="Baidu 搜索" />
<!--Baidu站内搜索结束-->
  你的沉默明亮如灯、简单如指环。

  论坛其他名字 【云水.墨】 【淡墨瀑雪】
回复

使用道具 举报

1788

主题

62

好友

8525

积分

管理员

Rank: 9Rank: 9Rank: 9

沙发
发表于 2009-12-31 00:11:27 |只看该作者
自己做站的时候放百度搜索代码时候,搜索汉字出现乱码,数字,英文都正常!
原因,你的网页程序编写定义的是:utf-8
而百度官方给的默认是:gbk
解决方法:
很多网友建议修改head部分编码语言,其实不可行!
修改官方代码中其中一行就行!
原码:<input name=tn type=hidden value=baidu>
请修改为:<input type=”hidden” name=”ie” value=”utf-8″ />
  你的沉默明亮如灯、简单如指环。

  论坛其他名字 【云水.墨】 【淡墨瀑雪】
回复

使用道具 举报

1788

主题

62

好友

8525

积分

管理员

Rank: 9Rank: 9Rank: 9

板凳
发表于 2009-12-31 00:16:00 |只看该作者

Google和百度站内搜索代码(乱码修正)

有意思吧

博文写多了,找起来会很麻烦,可以用Google或百度加上站内搜索的功能。网上曾有过两段Google和百度站内搜索的代码,如下(注意:代码中的“网站地址”要去掉http://

  1. <!--Google站内搜索开始-->
  2. <form method=get action="http://www.google.com/search">
  3. <input type=text name=q>
  4. <input type=submit name=btnG value="Google 搜索">
  5. <input type=hidden name=ie value=GB2312>
  6. <input type=hidden name=oe value=GB2312>
  7. <input type=hidden name=hl value=zh-CN>
  8. <input type=hidden name=domains value="网站地址">
  9. <input type=hidden name=sitesearch value="网站地址">
  10. </form>
  11. <!--Google站内搜索结束-->

  1. <!--Baidu站内搜索开始-->
  2. <form action="http://www.baidu.com/baidu">
  3. <input type=text name=word>
  4. <input type="submit" value="Baidu 搜索">
  5. <input name=tn type=hidden value="bds">
  6. <input name=cl type=hidden value="3">
  7. <input name=ct type=hidden value="2097152">
  8. <input name=si type=hidden value="网站地址">
  9. </form>
  10. <!--Baidu站内搜索结束-->

试用了一下,由于博客编码或者少代码的关系,可能出现以下两个问题。

1、出现乱码的解决方法:在form表单内添加如下代码(如果是Google的话,把代码里的GB2312改成UTF-8就可以了)

  1. <input type=hidden name=ie value="UTF-8">

2、搜索结果无法在新页面显示的解决方法:将第一行改为如下代码

  1. <form action="http://www.baidu.com/baidu" target="_blank">

下面是Google和百度Javascript版站内搜索代码(未测试)

  1. <!--Google站内搜索开始-->
  2. <script type="text/javascript">
  3. function googlesearch () {
  4. var wq=document.getElementsByName("wq")[0].value;
  5. var link="http://www.google.com/search?domains=网站地址&sitesearch=网站地址&q=" wq;
  6. window.open(link); }
  7. </script>
  8. <input type="text" name="wq"/><input type="submit" onclick="javascript:googlesearch()" value="Google 搜索" />
  9. <!--Google站内搜索结束-->

  1. <!--Baidu站内搜索开始-->
  2. <script language="javascript">
  3. function baidusearch () {
  4. var wd=document.getElementsByName("wd")[0].value;
  5. var link="http://www.baidu.com/s?si=网站地址&cl=3&ct=2097152&tn=baidulocal&word=" wd;
  6. window.open(link); }
  7. </script>
  8. <input type="text" name="wd"/><input type="submit" onclick="javascript:baidusearch()" value="Baidu 搜索" />
  9. <!--Baidu站内搜索结束-->  
  你的沉默明亮如灯、简单如指环。

  论坛其他名字 【云水.墨】 【淡墨瀑雪】
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

Archiver|手机版|云水网 ( 鲁ICP备09069806号 )

GMT+8, 2024-6-15 04:23 , Processed in 0.033859 second(s), 18 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部