form Á¦¾î°¡ ¼Û½ÅµÉ ¶§ ¼¹ö¿¡ ¼Û½ÅµÇ´Â °ªÀ» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
°³Ã¼°¡ ¼¹ö¿¡ ¼Û½ÅµÇ¸é name/value ¦ÀÌ ¼¹ö¿¡¼ÀÇ Ã³¸®¸¦ À§ÇÏ¿© ¼¹ö¿¡ Àü´ÞµÈ´Ù.
ÀÌ ¼Ó¼ºÀº Àбâ/¾²±âÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.
¼±Åà ¸ñ·Ï ¹Ú½º Á¦¾î¿¡¼ ¼±ÅÃµÈ Á¦¾îÀÇ °ª¸¸À» ¼Û½ÅÇÑ´Ù.
¿ìÈ£Àû ¼¹ö¿¡´Â »ç¿ëÀÚ¿¡ °ü°è¾øÀÌ µ¥ÀÌÅ͸¦ Á÷Á¢ ¼Û½ÅÇÒ ¼ö ÀÖ´Ù.
»ç¿ëÀÚ´Â ±× °ª(value)À» º¼ ¼ö ¾ø°í ³»ºÎ ÅؽºÆ®(innerText)¸¸À» º¼ ¼ö ÀÖ´Ù.
°³Ã¼ | script | HTML | ±Ô°Ý | IE |
---|
ÀÌ ¼Ó¼ºÀº (¿µ¹®) HTML 3.2¿Í (¿µ¹®) W3C DOM Level 1(Document Object Model)¿¡¼ Á¤ÀǵǾú´Ù.
<SCRIPT> function showResult(){ str='formName.selObj.selectedIndex='+formName.selObj.selectedIndex+'<BR>'; str+='formName.selObj.options(formName.selObj.selectedIndex).value='+ formName.selObj.options(formName.selObj.selectedIndex).value+'<BR>'; str+='formName.selObj.value='+formName.selObj.value+'<BR>'; showA.innerHTML=str; } </SCRIPT> <FORM name="formName" action="http://koxo.com/lang/js/object/exp/xsubmit.cgi"> <SELECT name="selObj" size="5" onchange="showResult()"> <OPTION value="itemNumb#11">¼±Åà Ç׸ñ 1</OPTION> <OPTION value="itemNumb#22" selected>¼±Åà Ç׸ñ 2</OPTION> <OPTION value="itemNumb#33">¼±Åà Ç׸ñ 3</OPTION> <OPTION value="itemNumb#44">¼±Åà Ç׸ñ 4</OPTION> <OPTION value="itemNumb#55">¼±Åà Ç׸ñ 5</OPTION> </SELECT><BR> <INPUT type="submit"> </FORM> <DIV id=showA>°á°ú Ç¥½Ãâ</DIV>