Latest web development tutorials

HTML tag <button>

Esempi

segnando un tasto il seguente codice:

<button type="button">点我!</button>

Prova »

Supporto per il browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Tutti i browser principali supportano tag <button>.


le definizioni e le istruzioni tag

<Button> tag definisce un pulsante.

Nel <tasto> all'interno dell'elemento, è possibile inserire il contenuto, ad esempio testo o immagini. Questa è la differenza tra l'elemento elemento e l'uso <input> per creare il pulsante mezzo.

Suggerimento: Sempre <tasto> elemento specifica l'attributo type.Browser diversi utilizzano diversi valori di default per l'attributo type <tasto> elemento.


Suggerimenti e Note

NOTA: Se si utilizza il <tasto> elemento in un modulo HTML, browser diversi possono presentare un diverso valore del pulsante.Si prega di utilizzare il <input> pulsante Crea in un modulo HTML.


Le differenze tra HTML 4.01 e HTML5

HTML5 nuovi attributi: messa a fuoco automatica, la forma, FormAction, formenctype, formmethod, formnovalidate e formtarget.


proprietà

Nuovo: HTML5 nuova proprietà.

属性 描述
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 规定按钮的初始值。可由脚本进行修改。


Proprietà globali

<Button> tag supporta HTML proprietà globali .


Proprietà evento

<Button> tag supporta proprietà dell'evento HTML .


articoli correlati

Manuale HTML DOM di riferimento: gli oggetti Button