Google免费站点搜索,发布查询

| 我有一个Google网站搜索 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\");
});
这不是理想的,但可以。用户单击搜索框时,会将他们重定向到搜索页面以保存它们,并输入两次查询。 谢谢你的帮助!     
已邀请:
        看看http://code.google.com/apis/customsearch/docs/js/cselement-reference.html#_methods-el 看起来您创建的控件是方法附带的。看来您正在寻找.execute(query)方法。     
        一种方法是在您的首页上放置iFrame代码,然后您可以对其进行自定义。您会发现各种方法。但是,如果您想进行更具个性化的设置,例如在搜索框中添加搜索结果,然后在页面中显示结果,那么我建议您执行一个后端过程来查询Google,然后将结果发布回去。查看我的意思是Nokogiri示例。     

要回复问题请先登录注册