我有一个谷歌网站搜索
http://www.google.com/cse/manage/create
这给了我以下工作代码:
<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('013080392637799242034:ichqh_hal4w');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
}, true);
</script>
在我的一些页面上,我有一个搜索框。我可以在该搜索框中输入文本,发布到该站点搜索脚本并加载吗?
例如:
- 用户在 Home.html 上
- 他们在搜索框中输入文本
- 将它们重定向到 Search.html
- Search.html 获取他们输入的文本并对其进行搜索,而无需在空框中重新输入
目前我有:
// Temporary measure
SearchBox.click(function (event) {
SearchBox.attr('disabled', 'disabled');
SearchBox.css("background", "#efefef");
window.location.replace(Domainroot + "/search");
});
这不太理想,但工作正常。当用户单击搜索框时,它会将他们重定向到搜索页面,以保存他们两次输入查询。
谢谢你的帮助!