HTML 5 <button> 標(biāo)簽
定義和用法
<button> 標(biāo)簽定義按鈕。您可以在 button 元素中放置內(nèi)容,比如文檔或圖像。這是該元素與由 input 元素創(chuàng)建的按鈕的不同之處。
HTML 4.01 與 HTML 5 之間的差異
在 HTML 5 中有一個(gè)新屬性:autofocus。
例子:
<button>Click Me!</button>
屬性
屬性 | 值 | 描述 | 4 | 5 |
---|---|---|---|---|
autofocus | true | false | 在頁面加載時(shí),是否讓按鈕獲得焦點(diǎn)。 | ? | 5 |
disabled | disabled | 禁用按鈕 | 4 | 5 |
name | button_name | 為按鈕規(guī)定為一的名稱。 | 4 | 5 |
type |
|
定義按鈕的類型。 | 4 | 5 |
value | some_value | 為按鈕規(guī)定初始值。該值可通過腳本改變。 | 4 | 5 |
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請(qǐng)?jiān)L HTML 5 中標(biāo)準(zhǔn)屬性。
事件屬性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,請(qǐng)?jiān)L HTML 5 中事件屬性。