提交按钮是否可以使用名称属性?

时间:2013-05-05 18:10:53

标签: html coding-style standards w3c-validation

通常,提交按钮在没有name属性的情况下正常工作。但是,有时候需要为同一个表单提供两个提交按钮,因此使用name属性来识别在服务器端单击了哪个按钮。

澄清我在谈论:<input type="submit" name="foo">

1 个答案:

答案 0 :(得分:3)

是的,完全可以接受。

规范has explicit rules for how to determine which submit button was successful,如果你不能给元素命名,这将是无用的。