如何从 html 输入生成自定义 URL? [英] How to generate a custom URL from a html input?

查看:114
本文介绍了如何从 html 输入生成自定义 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

then the program navigates to the link that is generated. This is like how Google Chrome's omnibox works.

推荐答案

只是简单的html表单

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>

这篇关于如何从 html 输入生成自定义 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆