我想将Google搜索栏整合到我的网站中,并使用Google CSE的默认代码:
<div id="cse-search-form" style="width: 100%;">Loading</div> <script src="https://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load('search','1',{language : 'en'}); google.setOnLoadCallback(function() { var customSearchOptions = {}; var imageSearchOptions = {}; imageSearchOptions['layout'] = google.search.ImageSearch.LAYOUT_POPUP; customSearchOptions['enableImageSearch'] = true; customSearchOptions['imageSearchOptions'] = imageSearchOptions; var customSearchControl = new google.search.CustomSearchControl( '003243520079760326318:WMX-1462312306',customSearchOptions); customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); var options = new google.search.DrawOptions(); options.setSearchFormRoot('cse-search-form'); options.setAutoComplete(true); customSearchControl.draw('shop.htm/cse',options); },true);
随后的样式和< / div>
但是我不希望结果在同一页面打开,我希望他们在searchresults.htm中打开它具有容器div
<div id="cse" style="width:100%;"></div>
如果我这样写:
<form action="http://www.amberantiques.com/searchresults.htm" id="cse-search-Box"> <fieldset style="border:none;"> <input type="hidden" name="cx" value="003243520079760326318:WMX-1462312306" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" size="31" /> <input type="submit" name="sa" value="Search" /> </fieldset> </form>
然后表单发送到页面,但不执行搜索,但如果您使用页面上的Google栏,则会运行搜索.
基本上,你如何让google bar打开结果页面?
干杯