0

我的 Google 自定义搜索一直卡在加载中。我在 Chrome 控制台中得到的 JS 错误是:

Uncaught TypeError: Object [object Object] has no method 'enableSearchBoxOnly' 

我的代码:

    <div class="search">
<div id='cse-search-form' style='width: 100%;'>Loading</div>
</div>
<script src='//www.google.com/jsapi' type='text/javascript'></script>
<script type='text/javascript'>
google.load('search', '1', {language: 'es', style: google.loader.themes.DEFAULT});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
var customSearchControl =   new google.search.CustomSearchControl('003806993800906102968:1a2oqwxzgqk', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchBoxOnly('https://www.globalsign.es/buscar', 'q');
customSearchControl.draw('cse-search-form', options);
}, true);
</script>

提前感谢您的帮助!

4

1 回答 1

2

API 参考表明大写enableSearchBoxOnly错误。尝试

options.enableSearchboxOnly('https://www.globalsign.es/buscar', 'q');

而不是以大写字母 b 开头的“框”。

options.enableSearchBoxOnly('https://www.globalsign.es/buscar', 'q');
                    ^
于 2013-04-22T16:59:28.847 回答