ÃÊÁ¡À» ¹ÞÀº document ¸ðü ¹®¼¿¡¼ ÃÊÁ¡À» ¹ÞÀº ¿¤·¹¸àÆ® °³Ã¼¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
ÀÌ ¼Ó¼ºÀº ÀбâÀü¿ëÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.
setActive³ª focus ¸Þ¼µå·Î È°¼º ¿¤·¹¸àÆ®¸¦ ÁöÁ¤ÇÒ ¼ö ÀÖ´Ù.
setActive ¸Þ¼µå¸¦ »ç¿ëÇϸé document ÃÊÁ¡¿¡ ¿µÇâÀ» Áֽà ¾ÊÀ¸³ª, focus ¸Þ¼µå¸¦ »ç¿ëÇϸé ÇØ´ç ¿¤·¹¸àÆ® °³Ã¼¿¡ ÃÊÁ¡ÀÌ °¡°í ±× °³Ã¼°¡ È°¼º °³Ã¼°¡ µÈ´Ù.
È°¼º ¿¤·¹¸àÆ®´Â ¸ðü document·ÎºÎÅÍ ´Ù¸¥°÷¿¡ ÃÊÁ¡ÀÌ °¡´õ¶óµµ, È°¼ºÀ» À¯ÁöÇÏ°í ÀÖ´Ù°¡ ´Ù½Ã ÃÊÁ¡ÀÌ ¸ðü document¿¡ ÁÖ¾îÁö¸é ±× È°¼º ¿¤·¹¸àÆ®·Î ÃÊÁ¡ÀÌ ÁÖ¾îÁø´Ù.
°³Ã¼ | script | HTML | ±Ô°Ý | IE |
---|
<SCRIPT> function showActive(){ str='document.activeElement.nodeName='+document.activeElement.nodeName+'<BR>'; str+='document.activeElement.name='+document.activeElement.name+'<BR>'; showA.innerHTML=str; } </SCRIPT> <FORM id="formObj" name="formName" action="http://koxo.com/lang/js/object/exp/xsubmit.cgi" method="get"> ¼º¸í: <INPUT name="inName" value="È«±æµ¿" onfocus="showActive()"><BR> ÁÁ¾ÆÇÏ´Â ²É: <SELECT name="flower" onfocus="showActive()"> <OPTION value="rose">Àå¹Ì <OPTION value="hibisicus" selected>¹«±ÃÈ <OPTION value="jindalae">Áø´Þ·¡ </SELECT> <P><INPUT type="reset" name="reset" onfocus="showActive()"> <INPUT type=submit> </FORM> <DIV id=showA>°á°ú Ç¥½Ãâ</DIV>