HTML button type属性
button type属性
HTML button元素内的type属性,可用于指定该button定义的按钮的类型是什么,可选的属性值如下表:
可选属性值
属性值 | 描述 |
---|---|
button | 指定该元素定义的是可点击的按钮 |
submit | 提交按钮 |
reset | 重置按钮 |
type属性实例代码,及在线编辑器
下方实例中,点击第一个按钮,将弹出一个欢迎的窗口,点击按钮2,将提交表单:
<form action='https://www.x1y1z1.com/search?' method='GET' target='_blank'>
<button type='button' onclick='alert("欢迎来到笨鸟工具,x1y1z1.com")'>按钮1</button>
<button type='submit' name='qsearchword' value='html'>按钮2</button>
</form>