【问题标题】:How to generate a custom URL from a html input?如何从 html 输入生成自定义 URL?
【发布时间】:2012-11-01 02:54:09
【问题描述】:

我想创建一个搜索栏,它接受查询并添加 URL 的其余部分,然后转到该站点。例如

输入:沃尔玛
输出:http://www.example.com/?t=w&p=0&q=walmart

然后程序导航到生成的链接。这就像 Google Chrome 的多功能框的工作原理。

【问题讨论】:

  • 好的。到目前为止,您尝试过什么?

标签: javascript html url search search-engine


【解决方案1】:

只是简单的html表单

<form method="GET" action="http://www.example.com/">
   <input type="text" name="q">
   <input type="hidden"  name="t" value="w">
   <input type="hidden"  name="p" value="0">
</form>

【讨论】:

    【解决方案2】:

    这是我为我的网站制作的内容:

    trapper.site90.net/luckysearch

    如果您愿意,可以使用我的代码。我测试了它。只需在我的页面上使用检查元素。 :D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-02
      • 2014-03-29
      • 1970-01-01
      • 1970-01-01
      • 2014-07-08
      • 1970-01-01
      • 2019-08-08
      • 1970-01-01
      相关资源
      最近更新 更多