HTML slt;button-and-label
The label is used to set buttons in HTML.Browser support
All major browsers support the hashtag.
Label definition and instructions for use
The label defines a button.
Inside the element, you can place content, such as text or images. This is the difference between the element and the button created with the .lt;input.gt; element.
Tip: Always specify the type property for the element. Different browsers use different default values for the type property of the element.
Tips and comments
Tip: The hashtag provides more power and richer content than the .lt;input type"button".
Note: Different browsers may submit different button values if the element is used in HTML forms. T he IE browser will submit the text between the labels, while other browsers will submit the contents of the value property. Please create a button in an HTML form using slt;input.
The difference between HTML 4.01 and HTML5
New properties in HTML5: autofocus, form, formaction, formenctype, formmethod, formnovalidate, and formtarget.
Property
New : The new property in HTML5.
属性 | 值 | 描述 |
---|---|---|
autofocus New | autofocus | 规定当页面加载时按钮应当自动地获得焦点。 |
disabled | disabled | 规定应该禁用该按钮。 |
form New | form_id | 规定按钮属于一个或多个表单。 |
formaction New | URL | 规定当提交表单时向何处发送表单数据。覆盖 form 元素的 action 属性。该属性与 type="submit" 配合使用。 |
formenctype New |
application/x-www-form-urlencoded
multipart/form-data text/plain |
规定在向服务器发送表单数据之前如何对其进行编码。覆盖 form 元素的 enctype 属性。该属性与 type="submit" 配合使用。 |
formmethod New |
get
post |
规定用于发送表单数据的 HTTP 方法。覆盖 form 元素的 method 属性。该属性与 type="submit" 配合使用。 |
formnovalidate New | formnovalidate | 如果使用该属性,则提交表单时不进行验证。覆盖 form 元素的 novalidate 属性。该属性与 type="submit" 配合使用。 |
formtarget New |
_blank
_self _parent _top framename |
规定在何处打开 action URL。覆盖 form 元素的 target 属性。该属性与 type="submit" 配合使用。 |
name | name | 规定按钮的名称。 |
type |
button
reset submit |
规定按钮的类型。 |
value | text | 规定按钮的初始值。可由脚本进行修改。 |
Global properties
The label supports the global properties of HTML.
The event property
The tag supports the event properties of HTML.
Related articles
HTML DOM Reference Manual: Button Object