Mark-up example for Checkpoint 12.3:
use of OPTGROUP


And here is some code that might generate the neatly ordered selection box list simulated on the previous page. However, please note that HTML4.0 does NOTallow the nesting of OPTGROUP elements as shown in this example. The HTML 4.0 specification states:

"Implementors are advised that future versions of HTML may extend the grouping mechanism to allow for nested groups (i.e., OPTGROUP elements may nest) as shown in the above example. This will allow authors to represent a richer hierarchy of choices."

<SELECT name="ComOS">
<OPTGROUP label="Comm Servers">

<OPTGROUP label="PortMaster 3">
<OPTION label="3.7.1" value="pm3_3.7.1"> PortMaster 3 with ComOS 3.7.1
<OPTION label="3.7" value="pm3_3.7"> PortMaster 3 with ComOS 3.7
<OPTION label="3.5" value="pm3_3.5"> PortMaster 3 with ComOS 3.5
</OPTGROUP>
<OPTGROUP label="PortMaster 2">
<OPTION label="3.7" value="pm2_3.7">PortMaster 2 with ComOS 3.7
<OPTION label="3.5" value="pm2_3.5">PortMaster 2 with ComOS 3.5
</OPTGROUP>

</OPTGROUP>


<OPTGROUP label="Routers">

<OPTGROUP label="IRX">
<OPTION label="3.7R" value="IRX_3.7R">IRX with ComOS 3.7R
<OPTION label="3.5R" value="IRX_3.5R"> IRX with ComOS 3.5R
</OPTGROUP>

</OPTGROUP>


Return to Example for Checkpoint 12.3
Copyright © 2000 W3C