问个问题,我的网站里面用了 Google Customer Search 的 API. 这样子呢,我的网站上就有了一个搜索的功能,我想问一下,怎么把搜索的内容放到另外的一个网页当中区。应为我想保持当前网页的风格的,如果不转网页,所有搜会来的东西,都挤在原来的一个狭小的空间中了,谢谢了。

解决方案 »

  1.   

    查看php怎么使数据 “挤在原来的一个狭小的空间是怎么工作”那你就知道了
      

  2.   

    下面就是 Google 自动生成的 Customer Search 代码,你可以贴在你的 html 中,单击搜索一下,如果你贴的地方很窄,那么搜出来的东西都挤在一起,如果贴在一个很宽的地方,那么他们就不会挤在一起,但是那个 div的高度 height 一定要是 auto,应为搜出来的东西不少。
         <tr ><td colspan = 2>
         <div id="cse" style="width: 100%; margin:auto;">Loading</div>
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
      google.load('search', '1', {language : 'en', style : google.loader.themes.GREENSKY});
      google.setOnLoadCallback(function() {
        var customSearchControl = new google.search.CustomSearchControl('011046381777514167653:22szpxgtwlk');
        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
        customSearchControl.setLinkTarget(
        google.search.Search.LINK_TARGET_SELF);
        customSearchControl.draw('cse');
      }, true);
    </script></td>
      

  3.   


    弹出层? 就是再开一个网页么? 能帮我写一下这个代码么,谢谢了,关乎饭碗。下面是google的搜索代码,麻烦大哥帮忙了。            <tr ><td colspan = 2>
                <div id="cse" style="width: 100%; margin:auto;">Loading</div>
    <script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
      google.load('search', '1', {language : 'en', style : google.loader.themes.GREENSKY});
      google.setOnLoadCallback(function() {
        var customSearchControl = new google.search.CustomSearchControl('011046381777514167653:22szpxgtwlk');
        customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
        customSearchControl.setLinkTarget(
        google.search.Search.LINK_TARGET_SELF);
        customSearchControl.draw('cse');
      }, true);
    </script></td>
      

  4.   


    弹出层或者include这段公用代码都可以,最简单的方法就是include这段公用代码