submit: The button submits the form data to the server. This is the default if the attribute is not specified, or if the attribute is dynamically changed to an empty or invalid value.
reset: The button resets all the controls to their initial values.
button: The button has no default behavior. It can have client-side scripts associated with the element's events, which are triggered when the events occur.
至于button和input之间的区别:
一个button可以有一个单独的值作为数据,而对于一个input来说,数据和按钮文本总是相同的:
<input type="button" value="Button Text"> <!-- Form data will be "Button Text" -->
<button type="button" value="Data">Button Text</button>
button可以有HTML内容(例如图像),而input只能有文本。
与CSS中的其他控件(如文本字段)相比,button可能更容易区分。注意浏览器的向后兼容性。
input {
}
button { /* Always works */
}
input[type=button] { /* Not supported in IE < 7 */
}
按钮的样式化比用于锚定标记(链接)的输入要好得多。
输入可以实现与按钮相同的功能,但设计更丑。
假设输入是老式的,按钮更酷。
类型为“button”的按钮不会提交表单,但类型为“type”或类型为“submit”(默认)的按钮将提交表单。type=submit的按钮与type=submit的输入几乎相同,但按钮可以包含HTML内容。
来自MDN:
至于
button
和input
之间的区别:一个
button
可以有一个单独的值作为数据,而对于一个input
来说,数据和按钮文本总是相同的:button
可以有HTML内容(例如图像),而input
只能有文本。与CSS中的其他控件(如文本字段)相比,
button
可能更容易区分。注意浏览器的向后兼容性。相关问题 更多 >
编程相关推荐