如何使用“搜索”按钮替换谷歌自定义搜索引擎的放大镜? [英] How to replace google custom search engine's magnifying glass with a button that says "search"?

查看:153
本文介绍了如何使用“搜索”按钮替换谷歌自定义搜索引擎的放大镜?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

这篇关于如何使用“搜索”按钮替换谷歌自定义搜索引擎的放大镜?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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