Html 使用不带JavaScript的联接查询组件输入

Html 使用不带JavaScript的联接查询组件输入,html,forms,input,noscript,Html,Forms,Input,Noscript,我有一个表单元素,我希望URL是 http://example.com/page.html?a=constant+查询文本 如果我愿意 http://example.com/page.html?a=constant&b=QUERY_TEXT 我可以用 <form action="http://example.com/page.html"> <input type="hidden" name="a" value="constant"> <input type=

我有一个
表单
元素,我希望URL是

http://example.com/page.html?a=constant+查询文本

如果我愿意

http://example.com/page.html?a=constant&b=QUERY_TEXT

我可以用

<form action="http://example.com/page.html">
  <input type="hidden" name="a" value="constant">
  <input type="text" name="b">
  <input type="submit">
</form>


但是有没有办法不用脚本就能得到我想要的表单呢?

你到底在发布什么表单呢?你用什么语言?我想我不完全理解你想做什么,因为这两个例子:

http://example.com/page.html?a=constant+QUERY_TEXT
http://example.com/page.html?a=constant&b=QUERY_TEXT
可以工作,并被接收表单的任何语言解析。解构字符串只需要一点逻辑。我在表单提交中使用jQuery和Ajax做了类似的事情

我有一个简单的按钮,其中包含以下几个关键参数:

<a class="alertDeleteButton" href="https://www.example.com/index.cfm?controller=hobbygroupmember&amp;action=deletemember&amp;deleteuserid=#userid#&amp;hobbyid=#id#&amp;adminid=#user.key()#" id="alertDeleteButton_#id#_#userid#" title="#deleteMemberText#">DELETE</a>
使用jQuery,我获得了所有需要的字段,然后通过ajax调用传递它们


这就是您想要做的吗?

您可以创建一个服务器代理来为您做这件事。在服务器上放置一个处理程序,将请求重定向到目标服务器,并将常量添加到querystring。根据您的web服务器的不同,您似乎只需要配置设置就可以做到这一点,而不需要代码

<form action="/myproxy">
  <input type="text" name="a">
  <input type="submit">
</form>
:



只有HTML而没有JavaScript是无法做到的。

不,没有JS是不可能的。只有JS可以执行DOM操作。我无法控制server example.com,因此我无法选择输入格式。例如,example.com可能是一个搜索引擎。我不能使用jQuery,因为我不能使用JavaScript。谢谢。我不知道在没有JavaScript或服务器的情况下怎么做,这证实了不仅仅是我。你的替代方案很好。
<form action="/myproxy">
  <input type="text" name="a">
  <input type="submit">
</form>
RedirectMatch ^/myproxy?a=(.+)$ http://example.com/page.html?a=constant+$1
<rewrite>
  <rules>
    <rule name="proxyRedirect" stopProcessing="true">
      <match url="^myproxy?a=(.+)$"/>
      <action type="Redirect" url="http://example.com/page.html?a=constant+{R:1}"/>
    </rule>
  </rules>
</rewrite>