How to generate a custom URL from a html input?

2019-08-23 02:18发布

I want to create a search bar which takes in a query and adds the rest of the URL then goes to the site. For example

Input: walmart
Output: 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.

2条回答
Viruses.
2楼-- · 2019-08-23 02:46

Here's something I made for my site:

trapper.site90.net/luckysearch

You may use my code if you want. I tested it. Just use inspect element on my page. :D

查看更多
Melony?
3楼-- · 2019-08-23 02:55

just simple html form

<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>
查看更多
登录 后发表回答