是否可以submit
在同一个 HTML 表单中定义两个按钮?
两个按钮将执行完全相同的功能..
但是,在给定时间只会显示一个.. 显示哪个取决于用户正在使用的设备(通过@media
查询解决)..
按钮技术上两个提交按钮将在 HTML 中定义。这可能吗?
You know you can actually use <button>
's in forms and they submit the form
<form action="">
<button>Submit 1</button>
<button>Submit 2</button>
</form>
This makes sense they are treated as submit buttons because you wouldn't have a button to take you somewhere or something while your filling out a form.
是的。但是,如果您不想 2 次提交输入,您可以创建按钮并设置 onclick javascript 处理程序以发送该表单。
CSS:
@media device1 {
#device2submitbutton {
display:none;
}
}
@media device2 {
#device1submitbutton {
display:none;
}
}
HTML:
<input type="submit" id="device1submitbutton" value="device1 submit"/>
<input type="submit" id="device2submitbutton" value="device2 submit"/>
<form action="" method="get">
<input type="submit" name="sb" value="One">
<input type="submit" name="sb" value="Two">
<input type="submit" name="sb" value="Three">
</form>
只需将其放在 HTML 页面中,单击按钮,然后查看 URL