提交按钮具有名称属性是否可以接受? [英] Is it acceptable for a submit button to have a name attribute?

查看:53
本文介绍了提交按钮具有名称属性是否可以接受?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,没有 name 属性的情况下,提交按钮可以正常工作.但是,在某些情况下,需要为同一表单使用两个提交按钮,因此利用 name 属性来确定在服务器端单击了哪个按钮.

Usually, a submit button works fine without a name attribute. However, there are occasions where there's a need to have two submit buttons for the same form, hence making use of the name attribute to identify which button was clicked on the server side.

为了澄清,我在说的是:< input type ="submit" name ="foo">

To clarify I am talking about: <input type="submit" name="foo">

推荐答案

是的,完全可以接受.

规范中有明确的规则,用于确定如何确定提交按钮成功,如果您不能给元素命名,那就没用了.

The specification has explicit rules for how to determine which submit button was successful, which would be useless if you couldn't give the element a name.

这篇关于提交按钮具有名称属性是否可以接受?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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