HTML 5 <optgroup> 標(biāo)簽
定義和用法
<optgroup> 標(biāo)簽定義選項組。此元素允許您組合選項。當(dāng)您使用一個長的選項列表時,對相關(guān)的選項進行組合會使處理更加容易。
HTML 4.01 與 HTML 5 之間的差異
沒有。
例子
<select><optgroup label="Swedish Cars">
<option value ="volvo">Volvo</option> <option value ="saab">Saab</option></optgroup>
<optgroup label="German Cars">
<option value ="mercedes">Mercedes</option> <option value ="audi">Audi</option></optgroup>
</select>
屬性
屬性 | 值 | 描述 | 4 | 5 |
---|---|---|---|---|
label | text_label | 定義選項組的標(biāo)注。 | 4 | 5 |
disabled | disabled | 在其首次加載時,禁用該選項組。 | 4 | 5 |
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請訪問 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
如需完整的描述,請訪問 HTML 5 中事件屬性。