站内搜索是一个网站必不可少的组成部分,站内搜索功能用于检索本站、快速定位本站相关内容,自己写站内搜索功能未尝不可,但借助现成强大的搜索引擎的站内搜索代码也不失为一种上策!
下面演示加入快速加入站内搜索功能(度娘谷姐结合体哦,亲!)
GOOGLE站内搜索代码: <!--Google站内搜索开始--> <form method=get action='https://www.google.com/search'> <input type=text name=q id='s' value='在这输入关键字搜索...' onfocus='if (this.value == '在这输入关键字搜索...') {this.value = '';this.className='ifocus'}' onblur='if (this.value == '') {this.value = '在这输入关键字搜索...';this.className=''}'> <input type=submit name=btnG value='查 找'> <input type=hidden name=ie value='utf-8'> <input type=hidden name=oe value='utf-8'> <input type=hidden name=hl value=zh-CN> <input type=hidden name=domains value='www.phpvar.com'> <input type=hidden name=sitesearch value='www.phpvar.com'> </form> <!--Google站内搜索结束-->
记住,要把上例中的“ www.phpvar.com“ 换成您的网站网址哦!现在,用用你的搜索吧。 如果您的中文搜索送到 Google 后成了乱码,那可能是您的 ie 值设定不合您的网页编码造成的。 参数参考: name=“sitesearch“ :告知 Google 你要搜索的指定网站或指定域名 name=“ie“:告知 Google 发送搜索词的网页编码,预设值为“UTF-8“,由于在中国很多网站是使用 GB2312 编码 name =“oe“ :告知 Google 显示搜索的网页编码,预设值为“UTF-8“,由于现代大部分机器都能支持“UTF-8“无误,因此你大概不需要调整次参数; name =“hl“ :告知 Google 显示搜索的网页语言。“zh-CN“为简体中文,“zh-TW“为繁体中文,“en“为英文。
使用了GOOGLE站内搜索代码,还可以加上baidu哥的百度搜索框提示功能,百度哥google姐结合体哦,亲! 在GOOGLE 站内搜索代码的基础上根据百度官网上的介绍链接https://www.baidu.com/search/sug/sugcode.html即可轻松为网站加上搜索框提示功能!
www.phpvar.com提示:其它搜索引擎的站内搜索代码请参考
百度免费搜索代码:https://www.baidu.com/search/guide.html
一搜站内搜索代码:https://www.yisou.com/site.html
Yahoo免费站内搜索代码:https://misc.yahoo.com.cn/site.html/
搜狗免费搜索代码:https://dir.sogou.com/union/
中搜免费搜索代码:https://union.zhongsou.com/
0条评论( 网友:0 条,站长:0 条 ) 网友评论{有您的评论更精彩....}