如何使用“搜索”按钮替换谷歌自定义搜索引擎的放大镜?

如何使用“搜索”按钮替换谷歌自定义搜索引擎的放大镜?

问题描述:

我正在使用GCSE的基本代码和标准紧凑主题:

I'm using the basic code and the standard "compact" theme for GCSE:

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

这会将输入按钮呈现为:

This renders the input button as:

<td class="gsc-search-button">
    <input type="image" src="http://www.google.com/uds/css/v2/search_box_icon.png" class="gsc-search-button gsc-search-button-v2" title="search">
</td>

我希望它像

<td class="gsc-search-button">
    <input type="button" value="search" title="search">
</td>

我似乎无法弄明白该怎么做。这可能吗?

I can't seem to figure out how to do it. Is this possible?

function myCallback() {
    $("td.gsc-search-button input").attr("type", "submit").attr("value", "submit");
}

window.__gcse = {
    callback: myCallback
}; //.......load google CSE tag after this

这适用于我和它保留所有事件处理程序。

This works for me and it keeps all of the event handlers in place.