fireEvent ¸Þ¼µå¸¦ ½Ã¿ëÇÒ ¶§ À̺¥Æ® ÄÁÅؽº¸¦ Àü´ÞÇϱâ À§ÇÏ¿© event °³Ã¼¸¦ »ý¼ºÇÑ´Ù.
¹Ýȯ°ªoValÀº »õ·Î¿î À̺¥Æ® °³Ã¼ÀÌ´Ù.
°³Ã¼ | script | IE |
---|
¿¹Á¦´Â createEventObject ¸Þ¼µå¿Í fireEvent ¸Þ¼µå¸¦ »ç¿ëÇÏ¿´´Ù.
À̺¥Æ® °³Ã¼ÀÇ expando ¼Ó¼ºÀ» ¼³Á¤ÇÏ¿© ¾î´À ¿¤·¹¸àÆ®°¡ Ʋ¸¯µÇ¾ú´Â°¡¸¦ ÆÇÁ¤Çϴµ¥ À̺¥Æ®Ã³¸®ÀÚ¿¡ ÀÇÇÏ¿© »ç¿ëµÈ´Ù.
<SCRIPT> function outBoxClick(){ if (event.expando=='from_inBox') showA.innerHTML='<B>³»ºÎ ¹Ú½º</B>¸¦ Ŭ¸¯ÇÏ¿© À̺¥Æ®°¡ ¹ß»ý'; else showA.innerHTML='<B>¿ÜºÎ ¹Ú½º</B>¸¦ Ŭ¸¯ÇÏ¿© À̺¥Æ®°¡ ¹ß»ý'; } function inBoxClick(){ var eventObj=document.createEventObject(); eventObj.expando='from_inBox'; outBox.fireEvent('onclick',eventObj); event.cancelBubble=true; } </SCRIPT> <DIV id="outBox" onclick="outBoxClick()" style="height:200;width:300;padding:50;background-color:#ffd;border:solid 1 blue">¿ÜºÎ ¹Ú½º <DIV id="inBox" onclick="inBoxClick()" style="height:100;width:200;padding:25;background-color:#fdf;border:solid 1 red">³»ºÎ¹Ú½º</DIV> </DIV> <DIV id=showA>°á°ú Ç¥½Ãâ</DIV>