搜索验证js

来源:互联网 发布:iphone连mac充电好吗 编辑:程序博客网 时间:2024/06/17 06:45
<div class="sousuo">
    <form name="searchform" method="post" action="" onSubmit="return search_check()" accept-charset="utf-8">
      <input type="hidden" name="channelid" value="291073" />
      <div id="searchBox">
        <input type="text" name="searchword" id="searchword" style="height:20px;" size="50" />
        <input type="submit" value="检索" style="cursor:pointer; border:none; background-color:transparent; width:67px;height:24px; font-size:14px;font-weight:bold;color:#008cc3;" />
      </div>
    </form>
    <script type="text/javascript">
        function search_check() {
            document.charset="utf-8";
            var sword =document.getElementById("searchword").value.replace(/^\s+|\s+$/g,"");
            if (sword=='' || sword=='请输入关键词') {
                alert('请输入关键词!');
                return false;
            } else {
                document.searchform.searchword.value = decodeURI(encodeURI(sword,"utf-8"));
                document.searchform.submit();
            }
        }</script>
  </div>
原创粉丝点击