输入类型=“提交” Vs按钮标签是否可以互换? [英] input type="submit" Vs button tag are they interchangeable?

查看:174
本文介绍了输入类型=“提交” Vs按钮标签是否可以互换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

input type="submit" and button tag are they interchangeable? or if there is any difference then When to use input type="submit" and when button ?

如果没有差异,那么为什么我们有2个标签用于同一目的?

And if there is no difference then why we have 2 tags for same purpose?

推荐答案

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


使用BUTTON元素函数创建的按钮就像使用INPUT创建的按钮元素,但它们提供更丰富的渲染可能性:BUTTON元素可能有内容。例如,包含图像的BUTTON元素的功能类似于并可能类似于INPUT元素,其类型设置为图像,但BUTTON元素类型允许内容。

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.

因此,对于功能而言,只有它们是可以互换的!

So for functionality only they're interchangeable!

(别忘了, type =submit按钮的默认值,所以请将其关闭!)

(Don't forget, type="submit" is the default with button, so leave it off!)

这篇关于输入类型=“提交” Vs按钮标签是否可以互换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆