我在我的网页中使用自定义Google搜索
代码:
<div id="cse" style="width: 100%;">Loading</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function(){
var customSearchControl = new google.search.CustomSearchControl('016457557644291857915:ivjbplcmt5k');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
}, true);
</script>
上面的代码工作正常,但它在该页面中显示了搜索结果。我想在单独的页面中显示搜索结果页面。
需要代码帮助
发布于 2010-01-01 01:53:50
您可以使用自定义搜索API中的特殊方法,只需在setResultSetSize()之后和draw()方法之前添加以下行:
customSearchControl.setLinkTarget(google.search.Search.LINK_TARGET_BLANK)
链接将在一个新窗口中打开。
我希望它能像你想要的那样工作。
发布于 2009-12-31 13:17:47
在LookFeel选项卡中选择Iframe怎么样?
Iframe。提供有限的自定义,并且您的站点上的结果需要单独的页面。
https://stackoverflow.com/questions/1983944
复制相似问题