Google和百度、雅虎的站内搜索代码

Tue 21 March 2006

Google和百度、雅虎的站内搜索代码

作者: 月光 网站建设

对于一个网站来说,使用搜索引擎来进行站内搜索往往比自己编写的站内搜索更高效,并且不占用网站服务器的资源,下面是我搜集到的几个主要搜索引擎(Google和百度、雅虎)的站内搜索代码,使用时只需要将代码里的\"www.williamlong.info\"替换成你的网址即可。

\<!--Google站内搜索开始--> \<form method=\"get\" action=\" https://www.google.com/search\"> \<input type=\"text\" name=\"q\" size=\"10\"> \<input type=\"submit\" name=\"btnG\" value=\"Google 搜索\"> \<input type=\"hidden\" name=\"ie\" value=\"utf-8\"> \<input type=\"hidden\" name=\"oe\" value=\"utf-8\"> \<input type=\"hidden\" name=\"hl\" value=\"zh-CN\"> \<input type=\"hidden\" name=\"domains\" value=\"www.williamlong.info\"> \<input type=\"hidden\" name=\"sitesearch\" value=\"www.williamlong.info\"> \</form> \<!--Google站内搜索结束-->

\<!--Baidu站内搜索开始--> \<form target=\"_blank\" action=\"http://zhannei.baidu.com/cse/site\"> \<input type=\"text\" name=\"q\" /> \<input type=\"submit\" value=\"Baidu 搜索\"> \<input name=\"ie\" type=\"hidden\" value=\"utf-8\" /> \<input name=\"cc\" type=\"hidden\" value=\"www.williamlong.info\" />\</form> \<!--Baidu站内搜索结束-->

\<!--Yahoo站内搜索开始--> \<form action=\"http://www.yahoo.com.cn/search\"> \<input type=text name=\"p\"> \<input type=\"submit\" value=\"Yahoo 搜索\"> \<input type=hidden name=vs value=\"www.williamlong.info\"> \</form> \<!--Yahoo站内搜索结束-->

下面是Google和百度的Javascript版的站内搜索代码:

\<!--Google站内搜索开始--> \<script type=\"text/javascript\"> function googlesearch () { var wq=document.getElementsByName(\"wq\")[0].value; var link=\"http://www.google.com/search?domains=www.williamlong.info&sitesearch=www.williamlong.info&q=\"+wq; window.open(link); } \</script> \<input type=\"text\" name=\"wq\"/>\<input type=\"submit\" onclick=\"javascript:googlesearch()\" value=\"Google 搜索\" /> \<!--Google站内搜索结束--> \<!--Baidu站内搜索开始--> \<script language=\"javascript\"> function baidusearch () { var wd=document.getElementsByName(\"wd\")[0].value; var link=\"http://www.baidu.com/s?si=www.williamlong.info&cl=3&ct=2097152&tn=baidulocal&word=\"+wd; window.open(link); } \</script> \<input type=\"text\" name=\"wd\"/>\<input type=\"submit\" onclick=\"javascript:baidusearch()\" value=\"Baidu 搜索\" /> \<!--Baidu站内搜索结束-->

Google和百度、雅虎的站内搜索代码

::: {#article_dig style="text-align: right"} []{#note447}顶一下 ▲}([]{#sdig447

)   踩一下 ▼}([]{#sdown447

) :::

::: {.previous_content} « 上一篇 贼喊捉贼-百度开通超级搜霸举报网站 :::

::: {.next_content} 下一篇 » 无毒一身轻------21天改变体质 :::

相关文章

Category: 月光博客2006