1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

转一个QQ搜索栏代码

本帖由 srsman2006-04-14 发布。版面名称:前端开发

  1. srsman

    srsman Active Member

    注册:
    2005-11-08
    帖子:
    1,920
    赞:
    6
    HTML:
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>qq搜索效果---yibote.126.com</title>
    <style type="text/css">
    body,table,select,ul,li{font-size:12px;line-height:23px;}
    
    .font{font-family: Arial, Helvetica, sans-serif;}
    .searchfod1{background:url(http://mat1.qq.com/www/images/10/searchfodbg1212.gif) no-repeat;font-weight:bold;color:#fff;width:100px;}
    .searchfod2{background:url(http://mat1.qq.com/www/images/10/searchfodbg21212.gif) no-repeat;width:100px;}
    .mb5{margin-bottom:5px;border:1px solid #92C3F2;border-top:0px;background:#D3E8FD}
    </style>
    <SCRIPT>
    var sosoCurrHighLight = document.getElementById("sosoweb");
    
    function trim(str){
     return str.replace(/(^\s*)|(\s*$)/g, "");
    }
    function sosoValidate(){
     wval = trim(frm_head.w.value);
     if(wval == "")
      return false;
     else
      return true;
    }
    
    
    function sosoSubSearch(sc){
     changePage(sc);
     if(!sosoValidate())
      return false;
     else{
      if(sc != "soba"){
       frm_head.sc.value = sc;
       frm_head.submit();
      }
      else{
       sosoGoSoba();
      }
     }
    }
    
    function sosoGoSoba(){
     
     frm_head.action = "http://post.soso.com/cgi-bin/cgimain";
     frm_head.kw.value = frm_head.w.value;
     frm_head.submit();
    }
    
    function changePage(sc){
     if(sosoCurrHighLight == null){
      sosoCurrHighLight = document.getElementById("sosoweb");
     }
     sosoCurrHighLight.className = "searchfod2";
     sosoCurrHighLight = document.getElementById("soso" + sc)
     sosoCurrHighLight.className = "searchfod1";
     frm_head.sc.value = sc;
     frm_head.action = "http://www.soso.com/q";
    }
    
    function isSoba(){
     if(sosoCurrHighLight == document.getElementById("sososoba")){
      sosoGoSoba();
      return false;
     }
     else{
      return true;
     }
    }
    </SCRIPT></head>
    <body>
    <center>
      <form name="frm_head" action="http://www.soso.com/q" onSubmit="return isSoba()" method="GET" target="_blank">
    <input type="hidden" name="sc" value="">
    <input type="hidden" name="ch" value="/blog/w.q">
    <input type="hidden" name="ty" value="1">
    <input type="hidden" name="kw" value="">
    <input type="hidden" name="proto" value="4">
    <table width="760"  border="0" align="center" cellpadding="0" cellspacing="0" background="http://mat1.qq.com/www/images/10/searchtbg1212.gif">
      <tr>
         <td align="center" height="23"> <table  border="0" cellspacing="0" cellpadding="0">
          <tr valign="top"align="center">
         <td id="sosoint" class="searchfod2" onclick="sosoSubSearch('int')">综合</td>
            <td width="4"></td>
            <td class="searchfod1" id="sosoweb" onclick="sosoSubSearch('web')">网页</td>
            <td width="4"></td>
            <td class="searchfod2" id="sosoimg" onclick="sosoSubSearch('img')">图片</td>
            <td width="4"></td>
      <td class="searchfod2" id="sosoforum" onclick="sosoSubSearch('forum')">论坛</td>
            <td width="4"></td>
            <td class="searchfod2" id="sosomus" onclick="sosoSubSearch('mus')">音乐</td>
            <td width="4"></td>
            <td class="searchfod2" id="sososoba" onClick="sosoSubSearch('soba')">搜吧</td>
          </tr>
        </table>
     </td>
      </tr>
    </table>
    <table width="760"  border="0" align="center" cellpadding="0" cellspacing="0"  class="mb5" height="32">
      <tr>
        <td width="125" align="center" style="padding-left:4px;"><a href="http://www.soso.com" class="sosoblack" target="_blank"><img src="http://mat1.qq.com/www/images/soso/soso_logo.gif" border="0"></a></td>
        <td width="363">
    <input name="w" type="text" size="50" style="font-size:14px;color:#000000;height:20px;border:#1989d7 1px solid;"></td>
        <td width="60"><input style="width:60px;height:22px;line-height:16px;margin:0;cursor: pointer;float:left; padding-top:1px;"  type="submit" value="搜 搜"></td>
        <td width="210" align="center"><a href="http://www.soso.com/q?w=06超女&sc=int&ch=w.q" target="_blank" class="sosoblue">2006超女</a>  <a href="http://music.soso.com/
    " target="_blank" class="sosoblue">新歌下载</a>  <a href="http://image.soso.com/" target="_blank" class="sosoblue">美女排行榜</a></td>
      </tr>
    </table>
    </form>
      <center>
    </body>
    </html>
    
    
    DEMO :http://blog.621000.net/qq.htm
     
  2. 老林

    老林 New Member

    注册:
    2005-09-06
    帖子:
    10,580
    赞:
    36
    很不错 偶喜欢
     
  3. 不学无术

    不学无术 Ulysses 的元神

    注册:
    2005-08-31
    帖子:
    16,714
    赞:
    39
    不错不错。