Google Site Search搜索按钮glyphicon

时间:2016-08-26 15:31:29

标签: javascript css google-api

他们是如何将搜索按钮文本修改为下方jsfiddle上的图标的?

我的页面上有完全相同的代码/标签(cx param除外),但搜索按钮文字显示" Search"并且旁边有一个X图标。我还没有在GSS控制面板中找到允许对按钮进行此类修改的任何设置。



// Make sure in jsFiddle you have selected option onLoad.
(function() {
  var cx = '017643444788069204610:4gvhea_mvga'; // Insert your own Custom Search Engine ID here
  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);
})();

<div style="border: 1px solid blue;">
    Area 1 (for example a sidebar)
    <gcse:searchbox></gcse:searchbox>
</div>

<div style="border: 1px solid red;">
    Area 2 (for example main area of the page)
    <gcse:searchresults></gcse:searchresults>
</div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

去那里:https://support.google.com/customsearch/answer/4513783?hl=en然后点击链接&#34;控制面板&#34;。

进入后,添加您的网站,然后查看左侧网站并按照以下说明操作:

How to replace google custom search engine's magnifying glass with a button that says "search"?