Google和百度、雅虎的站內搜尋代碼_網站應用程式

來源:互聯網
上載者:User
對於一個網站來說,使用搜尋引擎來進行站內搜尋往往比自己編寫的站內搜尋更高效,並且不佔用網站伺服器的資源,下面是我搜集到的幾個主要搜尋引擎(Google和百度、雅虎)的站內搜尋代碼,使用時只需要將代碼裡的"www.jb51.net"替換成你的網址即可。

<!--Google站內搜尋開始-->
<form method=get action="http://www.google.com/search">
<input type=text name=q>
<input type=submit name=btnG value="Google 搜尋">
<input type=hidden name=ie value=GB2312>
<input type=hidden name=oe value=GB2312>
<input type=hidden name=hl value=zh-CN>
<input type=hidden name=domains value="www.jb51.net">
<input type=hidden name=sitesearch value="www.jb51.net">
</form>
<!--Google站內搜尋結束-->

<!--Baidu站內搜尋開始-->
<form action="http://www.baidu.com/baidu">
<input type=text name=word>
<input type="submit" value="Baidu 搜尋">
<input name=tn type=hidden value="bds">
<input name=cl type=hidden value="3">
<input name=ct type=hidden value="2097152">
<input name=si type=hidden value="www.jb51.net">
</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.jb51.net">
</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.jb51.net&sitesearch=www.jb51.net&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.jb51.net&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站內搜尋結束-->

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.