gpt4 book ai didi

html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?

转载 作者:IT老高 更新时间:2023-10-28 11:04:56 27 4
gpt4 key购买 nike

input type="submit"button 标签可以互换吗?或者如果有任何区别,那么何时使用 input type="submit" 和何时使用 button

如果没有区别,为什么我们有 2 个标签用于相同目的?

最佳答案

http://www.w3.org/TR/html4/interact/forms.html#h-17.5

Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may resemble an INPUT element whose type is set to "image", but the BUTTON element type allows content.

因此,仅就功能而言,它们是可互换的!

(别忘了,type="submit"button 的默认设置,所以不要使用它!)

关于html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7117639/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com