html页面中的搜索栏脚本 [英] search bar script in html page

查看:136
本文介绍了html页面中的搜索栏脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在search-results.htm页面中包含的脚本以及它在para tag foll的body部分中的
。码。如果在搜索栏中输入了任何字符串,则它不会搜索网站,但它正在搜索谷歌。我希望它首先搜索网站,然后谷歌。



This is the script I have included in my search-results.htm page along with it
in body section in para tag foll. code. If any string is entered in the search bar, it is not searching the website, but it is searching the google. I want it to search the website first and then google.

<p style="text-align:justify">
                               <gcse:searchresults-only></gcse:searchresults-only>
                           </p>




<form  action="http://sysaptechnologies.com/sysap_data_files/search-results.htm">
            	<input value="FORID:11" name="cof" type="hidden"> 
            	<input value="005037316513311643510:bqpsfhldzd4" name="cx" type="hidden">


                    
                    	
                        	<input name="q" id="q" value="Search" onfocus="if(this.value=='Search') {this.value='';}"  önblur="if(this.value=='') {this.value='Search';}" class="bar" type="text">
                        
                        <input value="Search" class="go backcolr" type="submit">
                    
                    </form>>




<script>
  (function() {
    var cx = '005037316513311643510:bqpsfhldzd4';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>

推荐答案

您可以创建Google自定义搜索以仅搜索网站。



https://www.google.com/cse/create/new [ ^ ]



添加要搜索的sties的链接,然后点击创建。



接下来,Google将创建下一页一个脚本供您在您的站点中实现并提供HTML示例。
You can create a google custom search to search only the website.

https://www.google.com/cse/create/new[^]

Add the links to the sties you want to search and click on create.

Then on the next page Google will already create a script for you to implement in your site and give an HTML example.


这篇关于html页面中的搜索栏脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆