Option ű׿¡ ÀÇÇÏ¿© ÁöÁ¤µÈ ¹®ÀÚ¿­À» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.

Àμö
: (¼Ó¼º ¹®ÀÚ¿­)
¼Ó¼º°ªÀº Option ű׿¡ ÀÇÇÏ¿© ÁöÁ¤µÈ ¹®ÀÚ¿­ÀÌ´Ù.

ÀÌ ¼Ó¼ºÀº Àбâ/¾²±âÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.

Ư±â
text °ªÀ» »õ·Î ÁöÁ¤ÇÏ¸é ´çÃÊÀÇ text °ªÀº º¯°æµÇÁö¸¸, ±× °ªÀº º¯°æµÇÁö ¾Ê´Â´Ù.
formÀÌ ¼Û½ÅµÇ¸é µð½ºÇ÷¹ÀÌµÈ °ÍÀÌ ¾Æ´Ï¶ó ´çÃÊÀÇ ÀúÀåµÈ °ªÀÌ ¼Û½ÅµÈ´Ù.

Àû¿ë
°³Ã¼scriptHTML±Ô°ÝIE
ÂüÁ¶

ÀÌ ¼Ó¼ºÀº (¿µ¹®)DOM1(World Wide Web Consortium Document Object Model Level 1)¿¡¼­ Á¤ÀǵǾú´Ù.


form °³Ã¼ÀÇ ¼Ó¼º ¿¹Á¦

 

OptionÀÇ °ª(value)Àº º¯°æ½ÃÅ°Áö ¾Ê°í, ¼±Åà ¹®ÀÚ¿­(text)¸¸ º¯°æ½ÃŲ´Ù.

<SCRIPT>
function changeText(){
  for(var i=0;i<FNAME.selObj.options.length;i++){
    fname.selObj.options[i].text=fname.selObj.options[i].text+i;
  }
}
function showText(){
  var str='';
  for(var i=0;i<FNAME.selObj.options.length;i++){
    str+=i+'] value='+fname.selObj.options[i].value+', text='+fname.selObj.options[i].text+'<BR>';
  }
  showA.innerHTML=str;
}
</SCRIPT>

<FORM name=fname action="../object/exp/xsubmit.cgi">
<SELECT id=selObj name=selName onchange="showText()">
<OPTION value="apple">apple
<OPTION value="orange">orange
<OPTION value="peach">peach
<OPTION value="pear">pear
</SELECT>
<INPUT type=button value="Ŭ¸¯ÇÏ¿© º¯°æÇØ º¸±â" onclick="changeText()">
<INPUT type=submit value="¼Û½Å">
</FORM>
<DIV id=showA> </DIV>