<
html
>
<
body
>
<
script
>
function GetOptgroup(obj)
{
var optgroup=obj.parentNode;
while(optgroup.previousSibling.label)
{
optgroup=optgroup.previousSibling;
}
if(optgroup.label)
alert(optgroup.label);
}
</
script
>
<
select
onchange
=
'GetOptgroup(this.options[this.selectedIndex]);'
>
<
option
value
=
""
>商品系列 </
option
>
<
optgroup
label
=
"卧室家具"
>
<
option
value
=
"SA01"
>沙发 </
option
>
<
optgroup
label
=
" 床"
>
<
option
value
=
"BA01"
>实木床 </
option
>
<
option
value
=
"BA02"
>板式床 </
option
>
<
option
value
=
"BA03"
>布艺床 </
option
>
</
optgroup
>
</
optgroup
>
</
select
>
</
body
>
</
html
>