默认按钮类型是什么?
What is the default button type?
如果我这样做:
<button name="Save">Save</button>
我能保证它在所有浏览器中的行为方式相同吗?
据我所知,默认值是 "submit"
除了 IE 默认值是 "button"
有关详细信息,请参阅 this
编辑
根据微软开发者网络specification:
In IE8 Standards mode, the default value is submit. In other
compatibility modes and earlier versions of Windows Internet Explorer,
the default value is button.
输入按钮在浏览器中的外观可能有所不同,但输入的功能是相同的。
检查:button ,W3
对于大多数浏览器,button
的默认 type
是 submit
。
type = submit|button|reset [CI]
This attribute declares the type of the button. Possible values:
submit: Creates a submit button. This is the default value.
(http://www.w3.org/TR/html401/interact/forms.html#h-17.5)
唯一的例外是 IE7 及以下版本,默认 type
为 button
。
Windows Internet Explorer 8 and later. The default value of this attribute depends on the current document compatibility mode. In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.
(https://msdn.microsoft.com/en-us/library/ms534696(v=vs.85).aspx)
如果旧的 IE 支持不是问题(旧版本的 IE 在一个 form
上有多个 button
并且 button
的文本被传递也有问题value
) 中的 button
.
可以不提供 type
属性
如果我这样做:
<button name="Save">Save</button>
我能保证它在所有浏览器中的行为方式相同吗?
据我所知,默认值是 "submit"
除了 IE 默认值是 "button"
有关详细信息,请参阅 this
编辑
根据微软开发者网络specification:
In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.
输入按钮在浏览器中的外观可能有所不同,但输入的功能是相同的。 检查:button ,W3
对于大多数浏览器,button
的默认 type
是 submit
。
type = submit|button|reset [CI]
This attribute declares the type of the button. Possible values:
submit: Creates a submit button. This is the default value.
(http://www.w3.org/TR/html401/interact/forms.html#h-17.5)
唯一的例外是 IE7 及以下版本,默认 type
为 button
。
Windows Internet Explorer 8 and later. The default value of this attribute depends on the current document compatibility mode. In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.
(https://msdn.microsoft.com/en-us/library/ms534696(v=vs.85).aspx)
如果旧的 IE 支持不是问题(旧版本的 IE 在一个 form
上有多个 button
并且 button
的文本被传递也有问题value
) 中的 button
.
type
属性