html – 什么是默认按钮类型?

如果我这样做:
<button name="Save">Save</button>

我可以放心,它会在所有浏览器中表现相同吗?

解决方法

对于大多数浏览器,认类型的按钮是提交.

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及以下认类型为按钮的情况.

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的旧版本也有一个窗体上的多个按钮的问题,并且按钮的文本被传递而不是值),你可能会因为没有提供按钮的type属性而逃脱.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些