本實例主要是應(yīng)用optgrounp標(biāo)記,并設(shè)置其label屬性。optgroup標(biāo)記主要用于對select元素中的選項進(jìn)行邏輯分組,在optgroup標(biāo)記中指定的文本是非可選項,一般通過替換文本域可以選項區(qū)分開來。
實現(xiàn)分級下拉列表的關(guān)鍵代碼如下:
<form id="form1" name="form1" method="post" action=""> <table width="206" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="25" background="images/mid_01.jpg"> 圖書分類</td> </tr> <tr> <td height="28" align="center"><select name="book_class" id="book_class"> <optgroup label="Web設(shè)計"> <option>網(wǎng)站建設(shè)</option> <option>網(wǎng)頁設(shè)計</option> <option>JavaScript程序設(shè)計</option> </optgroup> <optgroup label="軟件世界"> <option>軟件工程</option> <option>軟件應(yīng)用</option> </optgroup> </select></td> </tr> </table></form>
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com