本实例主要是应用optgrounp标记,并设置其label属性。optgroup标记主要用于对select元素中的选项进行逻辑分组,在optgroup标记中指定的文本是非可选项,一般通过替换文本域可以选项区分开来。
实现分级下拉列表的关键代码如下:
<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设计">
<option>网站建设</option>
<option>网页设计</option>
<option>JavaScript程序设计</option>
</optgroup>
<optgroup label="软件世界">
<option>软件工程</option>
<option>软件应用</option>
</optgroup>
</select></td>
</tr>
</table></form> 以上就是html中分级下拉列表<optgroup>的详细内容,更多请关注Gxl网其它相关文章!
查看更多关于html中分级下拉列表<optgroup>的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did72443