表单提交 – 不提交已禁用输入的值?

前端之家收集整理的这篇文章主要介绍了表单提交 – 不提交已禁用输入的值?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我在firefox中找到的fireBug。

在其他浏览器中是否相同?

如果是这样,原因是什么?

解决方法

是的,所有浏览器都不应该提交禁用的输入,因为它们是只读的。

More info(第17.12.1节)

Attribute definitions

disabled [CI] When set for a form control,this boolean attribute
disables the control for user input. When set,the disabled attribute
has the following effects on an element:

  • Disabled controls do not receive focus.
  • Disabled controls are skipped in tabbing navigation.
  • Disabled controls cannot be successful.

The following elements support the disabled attribute: BUTTON,INPUT,
OPTGROUP,OPTION,SELECT,and TEXTAREA.

This attribute is inherited but local declarations override the
inherited value.

How disabled elements are rendered depends on the user agent. For
example,some user agents “gray out” disabled menu items,button
labels,etc.

In this example,the INPUT element is disabled. Therefore,it cannot
receive user input nor will its value be submitted with the form.

06000

Note. The only way to modify dynamically the value of the disabled attribute is through a script.

猜你在找的HTML相关文章