(输入类型=)提交按钮的默认值是多少? [英] What is the default value of a (input type=) submit button

查看:121
本文介绍了(输入类型=)提交按钮的默认值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个多语言网站,我想知道如何设置提交按钮的默认值? 它是特定于浏览器的东西,还是依赖于系统语言,还是两者都依赖? 即:我只是问我是否必须根据页面的语言设置特定的值,或者是否可以自动完成? 我一直无法在w3c规范中找到任何有关此的信息. 谢谢!

I am building a multilingual website and I was wondering how is set the default value of a submit button? Is it something browser specific or does it rely on the system language or both? ie : I'm just asking if I've to set a specific value according to the language of the page or if it will be done automatically? I've been unable to find anything about that in the w3c specs. Thanks!

推荐答案

HTML 4.01规范对此含糊不清,但是HTML5 CR更明确.它在说明中<input type=submit>的a>:如果元素具有value属性,则按钮的标签必须是该属性的值;否则,它必须是一个实现定义的字符串,表示提交"或诸如此类."这并未指定该字符串在任何意义上都应与语言相关,但实际上,它通常取决于浏览器的语言.

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.

结论是您应该始终设置value属性,以确保该属性使用 page 的语言,而且该信息具有参考价值.通常,表示提交"的通用名称过于抽象.

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.

在技术上,如果没有value属性,则未定义提交按钮的.这意味着getAttribute()方法产生null,并且元素节点的value属性是空字符串.但是,在提交表单时,实际上,浏览器的行为就像该值是它们用作按钮标签的字符串一样.

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.

这篇关于(输入类型=)提交按钮的默认值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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