用Google做站內資料搜索 - 2011.6.22

想可以方便地搜索自己站內的資料,除了製作自己的站內搜索器外,也可以用Google等搜索器做站內搜索。我們平時用Google搜索網站資料時,如果在要搜尋的資料後加上 "site:指定的網址" 就可以針對特定的網址做搜索。

如果需要把搜索欄加在自己的網頁,可以在網頁中加入以下程式碼:

<!--Start Google search-->
<form method=get action="http://www.google.com.hk/search">
<p align="right">
<input type=text name=q>
<input type=submit name=btnG value="搜尋">
<input type=hidden name=ie>
<input type=hidden name=oe>
<input type=hidden name=hl>
<input type=hidden name=domains value="你的網址">
<input type=hidden name=sitesearch value="你的網址">
</p>
</form>
<!--End Google search-->

執行結果如下:

把 domains value 和 sitesearch value 換成需要的網址即可。

 

 

KY'sHome | 攝影相關 | 電腦相關 | 我的相簿 | 其他類別