type
HTML <button> type 属性
两个 button 元素,一个是提交按钮,另一个是重置按钮:
实时编辑器
结果
Loading...
定义和用法
type 属性规定按钮的类型。
提示
提示: 请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。
HTML 4.01 与 HTML5之间的差异
无。
语法
<button type="button|submit|reset">
属性值
值 | 描述 |
---|---|
submit | 该按钮是提交按钮(除了 Internet Explorer,该值是其他浏览器的默认值)。 |
button | 该按钮是可点击的按钮(Internet Explorer 的默认值)。 |
reset | 该按钮是重置按钮(清除表单数据)。 |