The HTML 4.01 specification is rather vague about this, but the HTML5 CR is more explicit. It says, in the description of <input type=submit>
: “If the element has a value attribute, the button's label must be the value of that attribute; otherwise, it must be an implementation-defined string that means "Submit" or some such.” This does not specify that the string should be language-dependent in any sense, but in practice it usually depends on the language of the browser.
The conclusion that you should always set the value
attribute, to make sure it is in the language of the page and, moreover, that it is informative. Quite often, a generic name that means “submit” is too abstract.
On the technical side, the value of a submit button is undefined if there is no value
attribute. This means that the getAttribute()
method yields null
and the value
property of the element node is the empty string. However, on form submission, browsers in practice act as if the value were the string that they use as button label.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…