dedecms搜索框写法

 <div class="bg_search">
    <form id="forms" name="formsearch" action="{dede:global.cfg_cmsurl/}/plus/search.php" method="get">
        <div class="kuan">
            <input id="search-keyword" name="q" maxlength="30" value="请输入您要查找的内容/项目" onfocus="if(this.value=='请输入您要查找的内容/项目')this.value='';" onblur="if(this.value=='')this.value='请输入您要查找的内容/专家/项目';" type="text">
        </div>
        <div class="an"><input name="ok" type="search"></div>
        <script type="text/javascript">
            $(function () {
                $("input[name='ok']").bind("click", function () {
                    var keyword = $("input[name='keyword']").val();
                    if (keyword == "" || keyword == "请输入您要查找的内容/项目") {
                        return false;
                    }
                    $("#forms").submit();
                });
            });
        </script>
    </form>
</div>

 

posted @ 2016-09-24 10:40  景北斗  阅读(1904)  评论(0编辑  收藏  举报