什么是默认按钮类型? [英] What is the default button type?

查看:169
本文介绍了什么是默认按钮类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我这样做:

 < button name =Save> Save< / button> 

我可以确定它在所有浏览器中的行为方式都一样吗?

解决方案

对于大多数浏览器,按钮类型 $ c $是提交


type = submit | button |重置[CI]



该属性声明按钮的类型。可能的值:

submit:创建一个提交按钮。这是默认值。


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



唯一的例外是IE7和以下的默认类型按钮


Windows Internet Explorer 8及更高版本。此属性的默认值取决于当前的文档兼容模式。在IE8标准模式下,默认值为提交。在其他兼容模式和早期版本的Windows Internet Explorer中,默认值为按钮。


https://msdn.microsoft.com/en-us/library/ms534696(v =如果旧的IE支持不是问题(老版本的IE也会遇到多个 按钮在一个窗体按钮的文本上传递,而不是 value )你可能不会为<$​​ c $ c>按钮提供类型属性 code>。

If I do this:

<button name="Save">Save</button>

can I be assured that it will behave the same way across all browsers?

For most browsers the default type of button is submit.

type = submit|button|reset [CI]

This attribute declares the type of the button. Possible values:

submit: Creates a submit button. This is the default value.

(http://www.w3.org/TR/html401/interact/forms.html#h-17.5)

The only exception to this is IE7 and below where the default type is button.

Windows Internet Explorer 8 and later. The default value of this attribute depends on the current document compatibility mode. In IE8 Standards mode, the default value is submit. In other compatibility modes and earlier versions of Windows Internet Explorer, the default value is button.

(https://msdn.microsoft.com/en-us/library/ms534696(v=vs.85).aspx)

If old IE support is not an issue (older versions of IE also have trouble with multiple buttons on one form and the text of thebutton being passed through instead of thevalue) you can probably get away with not supplying the type attribute for a button.

这篇关于什么是默认按钮类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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