A Cooly Weblog

             ::  ::  ::  ::  :: 管理

          Google和百度、雅虎的站內(nèi)搜索代碼

          Posted on 2006-08-30 21:07 acooly 閱讀(307) 評論(0)  編輯  收藏 所屬分類: WEB開發(fā)
          對于一個網(wǎng)站來說,使用搜索引擎來進(jìn)行站內(nèi)搜索往往比自己編寫的站內(nèi)搜索更高效,并且不占用網(wǎng)站服務(wù)器的資源,下面是我搜集到的幾個主要搜索引擎(Google和百度、雅虎)的站內(nèi)搜索代碼,使用時只需要將代碼里的"www.williamlong.info"替換成你的網(wǎng)址即可。

          <!--Google站內(nèi)搜索開始-->
          <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.williamlong.info">
          <input type=hidden name=sitesearch value="www.williamlong.info">
          </form>
          <!--Google站內(nèi)搜索結(jié)束-->

          <!--Baidu站內(nèi)搜索開始-->
          <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.williamlong.info">
          </form>
          <!--Baidu站內(nèi)搜索結(jié)束-->

          <!--Yahoo站內(nèi)搜索開始-->
          <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站內(nèi)搜索結(jié)束-->

            下面是Google和百度的Javascript版的站內(nèi)搜索代碼:

          <!--Google站內(nèi)搜索開始-->
          <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站內(nèi)搜索結(jié)束-->

          <!--Baidu站內(nèi)搜索開始-->
          <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站內(nèi)搜索結(jié)束-->

          ??轉(zhuǎn)載自月光博客 [ http://www.williamlong.info/ ]
          主站蜘蛛池模板: 息烽县| 静安区| 兴安县| 徐水县| 晋宁县| 界首市| 黎城县| 南部县| 灵丘县| 珠海市| 靖州| 虹口区| 仙游县| 钦州市| 宜宾县| 镇远县| 长武县| 民和| 双城市| 涞源县| 共和县| 大英县| 巨野县| 泰来县| 崇信县| 毕节市| 上杭县| 沙河市| 郁南县| 新巴尔虎左旗| 大埔县| 岳阳市| 尤溪县| 平乐县| 中超| 齐齐哈尔市| 广宁县| 理塘县| 蒲城县| 隆化县| 辽阳县|