搜索框

<!--------------------------------------------------搜索框1------------------------------------------------><form name="frm_head" action="http://www.jqshw.com/so/search.asp" onSubmit="return searchValidate();" method="GET" target="_blank" class="search_form">
 <input name="search" type="text"     style="font-size:14px;color:#000000;420px;height:20px;border:#BBBBBB 1px solid;" value="请输入关键字"     onmouseover="this.focus()" onblur="if (value ==''){value='请输入关键字'}" onfocus="this.select()"     onclick="if(this.value=='请输入关键字')this.value=''">     <input style="60px;height:22px;line-height:16px;margin:0;cursor: pointer;float:left; padding-top:1px;" type="submit" value="搜 索">


</form>


<!------------------------------------------------搜索框2---------------------------------------------------><html>    <head>    <meta http-equiv=Content-Type content="text/html;charset=gb2312">    <title>百度搜索框,带智能提示</title>    <style>      td,a{font-family:arial}#kw{font:16px Verdana;height:1.78em;padding-top:2px}#b{height:30px;padding-top:4px}
#b,#b      0 3px !important;margin:0 0 10px}#sb{height:2em;5.6em}#km{height:50px}#l{margin:0      0 5px 15px}#l td{padding-left:107px}p,table{650px;border:0}#l td,#sb,#km{font-size:14px}#l      a,#l b{margin-right:1.14em}a{color:#00c}a:active{color:#f60}#hp{position:absolute;margin-left:6px}#lg
{margin:-26px      0 -44px}#lk{auto;line-height:18px;vertical-align:top}form{position:relative;z-index:9}    </style>  </head>  <body>

----把下面的代码放到需要的地方
<form name=f action=http://www.baidu.com/s><input type=text name=wd id=kw size=35 maxlength=100><input type=hidden 
name=tn value="jqshw_pg"><input type=hidden name=bar value=""><input type=submit value=搜索 id=sb></form>----把上面的代码放到需要的地方
  </body>

----把下面的代码放到文件末尾
  <script>    var w = document.f.wd;    function s(o) {      if (w.value.length > 0) {        var h = o.href;        var q = encodeURIComponent(w.value);        if (h.indexOf("q=") != -1) {          o.href = h.replace(new RegExp("q=[^&$]*"), "q=" + q)        } else {          o.href += "?q=" + q        }      }    }; (function() {      if (new RegExp("q=([^&]+)").test(location.search)) {        w.value = decodeURIComponent(RegExp.$1)      }    })();      document.write('<script src=http://www.baidu.com/js/bdsug.js?v=1.1.0.3><\/script>')    window.onunload = function() {};  </script>  <script>    w.focus()  </script>
</html>

原文地址:https://www.cnblogs.com/liaigang/p/1885523.html