dousong2023 2012-09-05 07:11
浏览 14
已采纳

如何使输入字段在单独的页面上进行Google自定义搜索

So I added Google Custom Search onto my site, and really like how it is functioning. One thing though, is that I want to make it so you can just click an input field at the top of the page, search, and have it redirect you to my page: http://www.example.com/search but put what they searched in the normal input field at the top of the page, into the google custom search box and search it.

More or less, this site right here is doing EXACTLY what I am trying to do, I'm not sure if its involving AJAX or what, but I am completely stumped and couldn't find a nice guide on how to do it anywhere.

http://www.a-g.com/ (try searching in the top right to see what I am talking about)

Is there an easy way to do this? Could anybody point me in the right direction at-least?

Thanks so much, have really been stressing about figuring this out.

  • 写回答

1条回答 默认 最新

  • duanbamo0127 2012-09-05 07:17
    关注

    You can visit the search URL with a q parameter like this: http://www.northtownsremodeling.com/search.php?q=gallery

    So it should basically work by simply submitting a form via GET with a "q" parameter that contains the search string.

    Something like:

    <form method="get" action="/search.php">
        <input name="q">
    </form>
    

    Demo: http://jsfiddle.net/csegM/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大