1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > input type=submit与type=button

input type=submit与type=button

时间:2023-12-12 18:54:19

相关推荐

input type=submit与type=button

input标签

1.type=button

定义可点击的按钮(通常与 JavaScript 一起使用来启动脚本)。

<input type="button">elements have no default behavior (their cousins,<input type="submit">and<input type="reset">are used to submit and reset forms, respectively). To make buttons do anything, you have to write JavaScript code to do the work.

(来自mdn:/en-US/docs/Web/HTML/Element/input/button)

菜鸟链接 /tags/att-input-type.html

2.type=submit

用于提交表单按钮

<input type="submit">按钮用于提交form表单. 如果你想要创建一个自定义的按钮,然后通过JavaScript自定义按钮的行为,你需要使用<input type="button">, 或者使用更好的<button>元素.

如果你选择使用<button>在你的form表单里创建按钮, 请记住: 它只是在<form>内部的<button>, 应该被当作"submit"按钮来处理。 所以你应该有一个明确指定哪一个按钮是提交按钮的习惯。

(来自mdn:/zh-CN/docs/Web/HTML/Element/input/submit)

button type

The default behavior of the button. Possible values are:

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, like<input type="reset">.

button: The button has no default behavior and does nothing when pressed. It can have client-side scripts associated with the element’s events, which are triggered when the events occur.

/en-US/docs/Web/HTML/Element/button

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。