【问题标题】:Google CSE with a custom form带有自定义表单的 Google CSE
【发布时间】:2013-02-20 13:54:03
【问题描述】:

我的页面顶部有一个 GET 表单,但尚未配置。我所拥有的就是:

    <div class="top-search">
        <form  method="get" id="searchform" action="#">
            <div>
                <input type="text" value="Search..." name="s" id="s" onfocus="defaultInput(this)" onblur="clearInput(this)" />
                <input type="submit" id="searchsubmit" value=" " />
            </div>
        </form>
    </div>

如何操纵它以使用 Google CSE?

【问题讨论】:

    标签: php html forms search-engine google-custom-search


    【解决方案1】:

    似乎没有人决定回答它,我自己发现了。

        <div class="top-search">
            <form id="searchform" action="http://www.google.com/cse">
                <div>
                    <input type="hidden" name="cx" value="xxxx" />
                    <input type="hidden" name="ie" value="UTF-8" />
                    <input type="text" value="" name="q" id="q" autocomplete="off" />
                    <input type="submit" id="searchsubmit" name="sa" value=" " />
                </div>
            </form>
    
        </div>
    

    其中“xxxx”是您的搜索引擎唯一 ID,可在控制面板的“基本信息”页面上找到。

    【讨论】:

    • 谢谢。这是一个很好的开始。谷歌 cse 似乎是任何网站的合乎逻辑的选择,将您的网站视为谷歌索引。输出的代码是一个雷区真是太可惜了。现在我需要解除样式表的关联
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-12
    • 1970-01-01
    • 2011-07-07
    • 2016-11-11
    相关资源
    最近更新 更多