给织梦网站添加搜索功能
最近在改版小冬SEO优化的网站,作为一个技术类型的网站,没有搜索框怎么能行呢,于是就想增加一个搜索框,同时还需要设置搜索频率,避免被不良人恶意搜索,占用网站资源,增加网站负担。
下面是织梦官方模板的搜索代码:
<form> <input name="q" type="text" id="search-keyword" value="{dede:global name='keyword' function='RemoveXSS(@me)'/}" onfocus="if(this.value=='在这里搜索...'){this.value='';}" onblur="if(this.value==''){this.value='在这里搜索...';}" /> <select name="searchtype" id="search-option"> <option value="title" selected='1'>检索标题</option> <option value="titlekeyword">智能模糊</option> </select> <button type="submit" class="search-submit">搜索</button> <a href="heightsearch.php">高级搜索</a> </form>
下面是我想要的样式,需要简化代码:
<form action="http://www.cdseoyh.cn/plus/search.php" name="formsearch" class="searchform1"> <button tabindex="3" class="sbtn" type="submit" value="提 交"><i class="icon-search1"></i></button> <input tabindex="2" name="q" class="sinput" placeholder="搜索" value="" type="text" id="q"> </form>
简化后的代码,这个时候需要我们对应改几个地方的参数
最后根据自己喜欢的样式,修改css代码,就能实现漂亮的搜索框了,这就是给织梦网站添加搜索功能!
版权保护: 本文由小冬SEO编辑发布,转载请保留链接: http://www.myseoyh.cn/cms/82.html