¼±ÅÃ(Option) ±¸·ìÀÇ ¶óº§(label)À» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
°³Ã¼ | script | HTML | ±Ô°Ý | IE |
---|
ÀÌ ¼Ó¼ºÀº (¿µ¹®) W3C DOM Level 1(Document Object Model)¿¡¼ Á¤ÀǵǾú´Ù.
<FORM name="formObj"> <SELECT name="selObj"> <OPTGROUP name="optGroupObj" label="¼±Åà ±¸·ì" style="color:blue"> <OPTION name="op1Obj">¼±ÅÃÇ׸ñ 1 <OPTION name="op2Obj" label="option2">¼±ÅÃÇ׸ñ 2 <OPTION name="op3Obj">¼±ÅÃÇ׸ñ 3 <OPTION name="op4Obj">¼±ÅÃÇ׸ñ 4 </OPTGROUP> <OPTION name="op5Obj">¼±ÅÃÇ׸ñ 5 </SELECT> </FORM> <SCRIPT> obj=document.all.tags("optGroup")[0]; str='document.all.tags("optGroup")[0].label="'+obj.label+'"<BR>'; str+='document.all.tags("opttion")[0].label='+obj.children[1].label+'<BR>'; document.write(str); </SCRIPT>