最新
版块
发主题
搜索
我的

请问这个搜索代码怎么改为海洋的搜索代码

淡忘丶小韩 2023-7-13 3410

                             <div class="site-search-form">

                                     <input type="text" id="txt" class="site-search-form-textinput" placeholder="请输入关键词"  onkeypress='return getKey(event)' onkeydown='return getKey(event)'/>

                                        <button  type="button" id="btn"  onclick='return goUrl()' class="site-search-form-button" title="请输入关键词"><svg class="site-svg-icon icon-search"><use xlink:href="#icon-search"></use></svg></button>

                          </div>

还有就是有没有办法搜索结果直接为这篇文章的内容页

最新回复 (4)
  • 海洋 2023-7-13
    0 引用 2
    视频搜索对应文件:根目录/search.php,input的name值:searchword,action=search.php

    文章搜索对应文件:根目录/so.php,input的name值:searchword,action=so.php

    如果需要使用搜索联想功能,调用根目录/ass.php

    你这个包含js部分,有的内容需要修改js文件,很简单,对照修改即可。

    搜索结果显示内容页不符合人类逻辑,也不符合机器逻辑,是自相矛盾的冲突。因为你不能保证搜索结果的唯一。
    但是可以在搜索结果列表里大段显示内容文本,标签为:[searchlist:des len=30]
  • 淡忘丶小韩 2023-7-13
    0 引用 3
    海洋 视频搜索对应文件:根目录/search.php,input的name值:searchword,action=search.php 文章搜索对应文件:根目录/so.php,input的name值: ...
    $(function(){$("#btn_type").click(function(){if($(".type_box").is(":hidden")){$(".type_box").slideDown();$("#btn_type").removeClass().addClass("btn_close")}else{$(".type_box").slideUp("fast");$(".handwrite_box").slideUp("fast");$("#btn_type").removeClass().addClass("btn_open");$("#handwrite_type").removeClass().addClass("handwrite_open")}});$(window).scroll(function(){if(document.body.scrollTop>100){$("#go_top").show()}else{$("#go_top").hide()}})});$(function(){$("#handwrite_type").click(function(){if($(".handwrite_box").is(":hidden")){$(".handwrite_box").slideDown();$("#handwrite_type").removeClass().addClass("handwrite_close")}else{$(".handwrite_box").slideUp("fast");$(".type_box").slideUp("fast");$("#handwrite_type").removeClass().addClass("handwrite_open");$("#btn_type").removeClass().addClass("btn_open")}});$(window).scroll(function(){if(document.body.scrollTop>100){$("#go_top").show()}else{$("#go_top").hide()}})});window.onload=function(){if(document.documentElement.scrollHeight<=document.documentElement.clientHeight){bodyTag=document.getElementsByTagName("body")[0];bodyTag.style.height=document.documentElement.clientWidth/screen.width*screen.height+"px"}setTimeout(function(){window.scrollTo(0,1)},0)};$(function(){$("#handwrite_type2").click(function(){if($(".handwrite_box").is(":hidden")){$(".handwrite_box").slideDown();$("#handwrite_type2").removeClass().addClass("handwrite_close")}else{$(".handwrite_box").slideUp("fast");$(".type_box").slideUp("fast");$("#handwrite_type2").removeClass().addClass("handwrite_open");$("#btn_type").removeClass().addClass("btn_open")}});$(window).scroll(function(){if(document.body.scrollTop>100){$("#go_top").show()}else{$("#go_top").hide()}})});window.onload=function(){if(document.documentElement.scrollHeight<=document.documentElement.clientHeight){bodyTag=document.getElementsByTagName("body")[0];bodyTag.style.height=document.documentElement.clientWidth/screen.width*screen.height+"px"}setTimeout(function(){window.scrollTo(0,1)},0)};function goUrl(){var oBtn=document.getElementById("btn");var oTxt=document.getElementById("txt");if(oTxt.value==null||oTxt.value==""){url="/"+escape(oTxt.value).toLowerCase().replace(/%u/g,"");window.location.href=url}else{url="/bihua/"+escape(oTxt.value).toLowerCase().replace(/%u/g,"")+".html";window.location.href=url}}function getKey(e){var oBtn=document.getElementById("btn");var oTxt=document.getElementById("txt");var keynum;if(window.event){keynum=e.keyCode}else{if(e.which){keynum=e.which}}if(keynum==13){if(oTxt.value==null||oTxt.value==""){url="/"+escape(oTxt.value).toLowerCase().replace(/%u/g,"");window.location.href=url}else{url="/bihua/"+escape(oTxt.value).toLowerCase().replace(/%u/g,"")+".html";window.location.href=url}}};


    大佬 帮忙看看怎么改  改了一些 但是搜索出来驴唇不对马嘴,结果是直接跳转到内容页的
  • 海洋 2023-7-14
    0 引用 4
    淡忘丶小韩 hanzi5.com 在这个搜索结果就是直接显示的内容页,很牛p,适用于这种类型的网站 实在不行就把搜索去掉了
    如果你的搜索结果是唯一的,搜索结果永远都是一个,那就简单了,直接跳转到第一条记录的网址就可以了,可以js html php 任何一个语言实现跳转。
  • 海洋 2023-7-14
    0 引用 5
    淡忘丶小韩 $(function(){$("#btn_type").click(function(){if($(".type_box").is(":hidden& ...
    爱莫能助
返回