[英]How to generate a custom URL from a html input?
I want to create a search bar which takes in a query and adds the rest of the URL then goes to the site. 我想创建一个搜索栏,它接受一个查询并添加其余的URL,然后转到该站点。 For example
例如
Input: walmart 输入: 沃尔玛
Output: http://www.example.com/?t=w&p=0&q= walmart 输出: http : //www.example.com/? t = w&p =0& q = walmart
then the program navigates to the link that is generated. 然后程序导航到生成的链接。 This is like how Google Chrome's omnibox works.
这就像Google Chrome浏览器的多功能框的工作方式一样。
just simple html form 只是简单的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>
Here's something I made for my site: 这是我为自己的网站制作的:
trapper.site90.net/luckysearch trapper.site90.net/luckysearch
You may use my code if you want. 如果需要,可以使用我的代码。 I tested it.
我测试了 Just use inspect element on my page.
只需在我的页面上使用inspect元素即可。 :D
:D
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.