ȨÆäÀÌÁöÁ¦ÀÛ±³½Ç
ȨÆäÀÌÁö Á¦ÀÛ±âÃÊ
±âº»Å±×
ÅÂ±×ÆÁ¸ðÀ½
ű×ÀÚ·á¹æ
Æ÷Åä¼¥°ÁÂ
À¥.°ü·Ã°ÁÂ
PHP°ÁÂ
PHPÆÁ
HTML.CSS
JAVASCRIPT
ASP
JSP
PHP½ÉÈ
C.C++
Ç÷¡½Ã.ActionScript
ÀÚÀ¯°Ô½ÃÆÇ
Áú¹®°Ô½ÃÆÇ
À¯¸Ó°Ô½ÃÆÇ
¿À¶ô½Ç
Tel. 042-353-2371
ÆòÀÏ ¿ÀÀü 9½Ã ~ ¿ÀÈÄ 7½Ã
±â¾÷ÀºÇà
010-8649-6758
¿¹±ÝÁÖ:Á¦ÁÖ»ç¶û(¼ÛÁø¾Æ)
JAVASCRIPT
Ȩ > ȨÆäÀÌÁöÁ¦ÀÛ±³½Ç > JAVASCRIPT
ÀÛ¼ºÀÚ
freewebkorea
Ä«Å×°í¸®
JavaScript
Tutorial
Object
ºñ¹Ð¹øÈ£
Á¦¸ñ
<H2>event Object</H2> <P class=mtext>event Property´Â JavaScriptÀÇ Keyboard event, Mouse event µî¿¡ ÀÇÇØ ¹ß»ýÇÏ´Â mouseÀÇ ÁÂÇ¥¶óµçÁö, ¾î¶² Keyboard°¡ ´·ÁÁ³´ÂÁö ¶Ç´Â event°¡ ¹ß»ýÇÏ´Â object¿¡ ´ëÇÑ Á¤º¸µéÀ» return ÇØ ÁÝ´Ï´Ù.</P><!-- »ç¿ë¹ý µé¾î°¡´Â Å×ÀÌºí ½ÃÀÛ --> <TABLE class=attributeTbl cellSpacing=2 cellPadding=0 border=0> <TBODY> <TR> <TD class=titleCell colSpan=2>event Object Property</TD></TR> <TR> <TD class=syntaxLeftCell width="15%">altKey</TD> <TD class=syntaxRightCell>alt Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR><!-- »ç¿ë¹ý µé¾î°¡´Â inline row Å×ÀÌºí ½ÃÀÛ --> <TD class=syntaxLeftCellshort>button</TD> <TD class=inlineRightCellTitle width="100%"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD class=RightCellTitle colSpan=2>mouse buttonÀÌ ´·ÁÁø »óÅ return</TD></TR> <TR> <TD class=inlineLeftCellshort width=50>0</TD> <TD class=inlineRightCell>¾Æ¹« button µµ ¾È ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>1</TD> <TD class=inlineRightCell>¿ÞÂÊ buttonÀÌ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">2</TD> <TD class=inlineRightCell width="85%">¿À¸¥ÂÊ buttonÀÌ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>3</TD> <TD class=inlineRightCell>¿ÞÂʰú ¿À¸¥ÂÊ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">4</TD> <TD class=inlineRightCell width="85%">°¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>5</TD> <TD class=inlineRightCell>¿ÞÂʰú °¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">6</TD> <TD class=inlineRightCell width="85%">¿À¸¥Âʰú °¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>7</TD> <TD class=inlineRightCell>3°³ÀÇ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR></TBODY></TABLE></TD></TR><!-- »ç¿ë¹ý µé¾î°¡´Â inline row Å×ÀÌºí ³¡--> <TR> <TD class=syntaxLeftCell>clientX</TD> <TD class=syntaxRightCell>â Å׵θ®¿Í scrollbar ¸¦ Á¦¿ÜÇÑ ¿µ¿ª¿¡¼ÀÇ mouseÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>clientY</TD> <TD class=syntaxRightCell>â Å׵θ®¿Í scrollbar ¸¦ Á¦¿ÜÇÑ ¿µ¿ª¿¡¼ÀÇ mouseÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>ctrlKey</TD> <TD class=syntaxRightCell>ctrl Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR> <TD class=syntaxLeftCell>keyCode</TD> <TD class=syntaxRightCell>Keyboard ¹®ÀÚÀÇ <A href="http://www.cadvance.org/doc/css/pseudo/iso-latin-1.asp" target=_blank>Unicode(ISO-Latin-1 character set)</A> °ª return</TD></TR> <TR> <TD class=syntaxLeftCell>offsetX</TD> <TD class=syntaxRightCell>event °¡ ¹ß»ýÇÏ´Â box(object) ÁÂÃø »ó´Ü¿¡ ´ëÇÑ mouse cursorÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>offsetY</TD> <TD class=syntaxRightCell>event °¡ ¹ß»ýÇÏ´Â box(object) ÁÂÃø »ó´Ü¿¡ ´ëÇÑ mouse cursorÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>screenX</TD> <TD class=syntaxRightCell>»ç¿ëÀÚ ¸ð´ÏÅÍ¿¡ ´ëÇÑ mouse cursorÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>screenY</TD> <TD class=syntaxRightCell>»ç¿ëÀÚ ¸ð´ÏÅÍ¿¡ ´ëÇÑ mouse cursorÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>shiftKey</TD> <TD class=syntaxRightCell>shift Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR> <TD class=syntaxLeftCell>srcElement</TD> <TD class=syntaxRightCell>event°¡ ¹ß»ýÇÏ´Â element return</TD></TR> <TR> <TD class=syntaxLeftCell>x</TD> <TD class=syntaxRightCell>»ó´ë À§Ä¡·Î positioning (position:relative;) µÈ 1 ´Ü°è »óÀ§ element ¿¡ ´ëÇÑ mouse cursorÀÇ x »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>y</TD> <TD class=syntaxRightCell>»ó´ë À§Ä¡·Î positioning (position:relative;) µÈ 1 ´Ü°è »óÀ§ element ¿¡ ´ëÇÑ mouse cursorÀÇ y »ó´ë ÁÂÇ¥</TD></TR></TBODY></TABLE><!-- »ç¿ë¹ý µé¾î°¡´Â Å×ÀÌºí ³¡--><BR><BR> <HR class=grayHr> <BR><B>shiftKey, ctrlKey, altKey</B> <P class=mtext>shiftKey, ctrlKey, altKey °¡ ´·ÁÁø »óÅÂÀÎÁö ¾Æ´ÑÁö¸¦ true(1), false(0) °ªÀ¸·Î return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â div ½ÃÀÛ --><B>¿¹Á¦</B> <DIV class=input id=shift_ctrl_alt><html><BR><head><BR><title>shiftKey, ctrlKey, altKey</title><BR><script type="text/javascript"><BR><!--<BR>function shiftKeyPressed(){<BR>if (event.<B>shiftKey</B>==1){<BR>alert("shift key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("shift key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR><BR>function ctrlKeyPressed(){<BR>if (event.<B>ctrlKey</B>==1){<BR>alert("ctrl key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("ctrl key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR><BR>function altKeyPressed(){<BR>if (event.<B>altKey</B>==1){<BR>alert("alt key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("alt key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR>// --><BR></script><BR></head><BR><body><BR><div style="width:100%; height:150px;background-color:tomato;"<BR>onmousedown="shiftKeyPressed();">shift Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR><div style="width:100%; height:150px;background-color:royalblue;"<BR>onmousedown="ctrlKeyPressed();">ctrl Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR><div style="width:100%; height:150px;background-color:palegreen;"<BR>onmousedown="altKeyPressed();">alt Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR></body><BR></html> </DIV><!-- ÀÔ·Â div ³¡--><BR><BR><A href="javascript:copy2Clipboard(shift_ctrl_alt);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>button</B> <P class=mtext>½ÇÇà ÇÑ ÈÄ¿¡ ¿À¸¥ÂÊ ¹öưÀ» ´·¯ º¸°í event.button == 2 ¿¡¼ 2¸¦ 1 ~ 7 »çÀÌÀÇ ¼ö¸¦ ¹Ù²Ù¾î ÀÔ·ÂÇÏ°í ½ÃÇèÇØ º¸¼¼¿ä... µ¿½Ã¿¡ ´©¸£´Â °æ¿ì ¹öư 2°³¸¦ °°Àº ¼ø°£¿¡ ´·¯¾ß µÈ´Ù´Â ¶æÀÌ ¾Æ´Ï¶ó 2°³°¡ ´·Á Áö±â¸¸ ÇÏ¸é µÈ´Ù´Â ¶æÀÔ´Ï´Ù. ½Ã°£ ¸ÂÃç¼ °°ÀÌ ´©¸¦¶ó°í ¾Ö¾²Áö ¸¶½ÃÁ®...</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B class=pos>ÀÔ·Â</B> <PRE class=input id=button_2><html> <head> <title>button</title> <script type="text/javascript"> <!-- function button_2(){ if (event.button == 2) {alert ("¿À¸¥ÂÊ button À» ´·¶½À´Ï´Ù.")} } // --> </script> </head> <body onmousedown="button_2();"> ¿À¸¥ÂÊ ¹öưÀ» ´©¸£½ÃÁ®... ±×¸®°í event.button == 2 ¿¡¼ 2¸¦ 1 ~ 7 »çÀÌÀÇ ¼ö¸¦ ¹Ù²Ù¾î ÀÔ·ÂÇÏ°í ½ÃÇèÇØ º¸¼¼¿ä... </body> </html> </PRE><!-- ÀÔ·Â pre ³¡--><A href="javascript:copy2Clipboard(button_2);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>srcElement, keyCode</B> <P class=mtext>srcElement´Â event°¡ ¹ß»ýÇÏ´Â ¹°Ã¼(object)ÀÇ Á¤º¸¸¦ return Çϰí, keyCode ´Â Keyboard ¹®ÀÚÀÇ <A href="http://www.cadvance.org/doc/css/pseudo/iso-latin-1.asp" target=_blank>Unicode</A> °ª(¼ýÀÚ)À» return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B class=pos>ÀÔ·Â</B> <PRE class=input id=srcElement_keyCode><html> <head> <title>srcElement, keyCode</title> <script type="text/javascript"> <!-- function whichButton(){ alert(event.keyCode) } function whichElement(){ tag_Name = event.srcElement.tagName tag_ID = event.srcElement.id alert("³ª´Â " + tag_Name + " element À̰í, id´Â " + tag_ID + " ÀÔ´Ï´Ù.") } // --> </script> </head> <body id="main" onkeyup="whichButton()" onclick="whichElement()"> ¸ÕÀú Ŭ¸¯À» ÇÑ ÈÄ¿¡ Keyboard¸¦ ´·¶´Ù ¶¼¸é Unicode °ªÀÌ alert â¿¡ ³ª¿À°Ô µË´Ï´Ù.<br /> Áï, â¿¡ focus°¡ µé¾î ¿Â »óÅ¿¡¼¸¸ OnKeyUp ÀÌ ¸Ô½À´Ï´Ù. <p id="para">p ÀÔ´Ï´Ù.</p> <div id="box">div ÀÔ´Ï´Ù.</div> <span id="inline">span ÀÔ´Ï´Ù.</span><br /> <button type="button" id="btn">button ÀÔ´Ï´Ù.</button> </body> </html> </PRE><!-- ÀÔ·Â pre ³¡--><A href="javascript:copy2Clipboard(srcElement_keyCode);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>offsetX, offsetY</B> <P class=mtext>offsetX, offsetY ´Â Àý´ëÀ§Ä¡(absolute)·Î positioning µÈ boxÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ mouseÀÇ X¿Í YÀÇ ÁÂÇ¥¸¦ return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B>ÀÔ·Â</B> <DIV class=input id=offset_xy><html><BR><head><BR><title>offsetX, offsetY</title><BR><script type="text/javascript"><BR><!--<BR>function offsetCoords() {<BR>var offsetInfo = ""<BR>offsetInfo = "offsetX : " + window.event.<B>offsetX</B> + "r"<BR>offsetInfo += "offsetY : " + window.event.<B>offsetY</B> + "r"<BR>alert(offsetInfo);<BR>}<BR><BR>function offsetStatus(){<BR>window.status = "X = " + window.event.<B>offsetX</B> + " Y = " + window.event.<B>offsetY</B><BR>} <BR>// --><BR></script><BR></head><BR><body onmousemove="offsetStatus()" ondblclick="offsetCoords();"><BR>mouse cursor°¡ box ¹Û¿¡ ÀÖÀ» ¶§´Â âÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ »ó´ëÁÂÇ¥°¡ status bar¿¡ Ç¥½ÃµÇ°í<BR>bouble Click Çϸé alert â¿¡ x, y ÁÂÇ¥°¡ ¶ß°í, box ¼ÓÀ¸·Î µé¾î°¡¸é boxÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ »ó´ëÁÂÇ¥°¡ Ç¥½ÃµÇ°í, click Çϸé alert â¿¡ x, y ÁÂÇ¥°¡ Ç¥½Ã µË´Ï´Ù.<BR><DIV onclick="offsetCoords();" STYLE="width:200; height:200; background-color:gray; position:absolute; top:100; left:200; color:gold;"><BR>ÀÌ DIV box´Â top:100px, left:300px À§Ä¡¿¡ position:absolute·Î positioning µÈ box ÀÔ´Ï´Ù.<BR></DIV><BR></body><BR></html> </DIV><!-- ÀÔ·Â pre ³¡--><BR><BR><A href="javascript:copy2Clipboard(offset_xy);open_window2('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR><BR> <HR class=blackHr>
<H2>event Object</H2> <P class=mtext>event Property´Â JavaScriptÀÇ Keyboard event, Mouse event µî¿¡ ÀÇÇØ ¹ß»ýÇÏ´Â mouseÀÇ ÁÂÇ¥¶óµçÁö, ¾î¶² Keyboard°¡ ´·ÁÁ³´ÂÁö ¶Ç´Â event°¡ ¹ß»ýÇÏ´Â object¿¡ ´ëÇÑ Á¤º¸µéÀ» return ÇØ ÁÝ´Ï´Ù.</P><!-- »ç¿ë¹ý µé¾î°¡´Â Å×ÀÌºí ½ÃÀÛ --> <TABLE class=attributeTbl cellSpacing=2 cellPadding=0 border=0> <TBODY> <TR> <TD class=titleCell colSpan=2>event Object Property</TD></TR> <TR> <TD class=syntaxLeftCell width="15%">altKey</TD> <TD class=syntaxRightCell>alt Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR><!-- »ç¿ë¹ý µé¾î°¡´Â inline row Å×ÀÌºí ½ÃÀÛ --> <TD class=syntaxLeftCellshort>button</TD> <TD class=inlineRightCellTitle width="100%"> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD class=RightCellTitle colSpan=2>mouse buttonÀÌ ´·ÁÁø »óÅ return</TD></TR> <TR> <TD class=inlineLeftCellshort width=50>0</TD> <TD class=inlineRightCell>¾Æ¹« button µµ ¾È ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>1</TD> <TD class=inlineRightCell>¿ÞÂÊ buttonÀÌ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">2</TD> <TD class=inlineRightCell width="85%">¿À¸¥ÂÊ buttonÀÌ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>3</TD> <TD class=inlineRightCell>¿ÞÂʰú ¿À¸¥ÂÊ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">4</TD> <TD class=inlineRightCell width="85%">°¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>5</TD> <TD class=inlineRightCell>¿ÞÂʰú °¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort width="15%">6</TD> <TD class=inlineRightCell width="85%">¿À¸¥Âʰú °¡¿îµ¥ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR> <TR> <TD class=inlineLeftCellshort>7</TD> <TD class=inlineRightCell>3°³ÀÇ buttonÀÌ µ¿½Ã¿¡ ´·ÁÁø »óÅÂ</TD></TR></TBODY></TABLE></TD></TR><!-- »ç¿ë¹ý µé¾î°¡´Â inline row Å×ÀÌºí ³¡--> <TR> <TD class=syntaxLeftCell>clientX</TD> <TD class=syntaxRightCell>â Å׵θ®¿Í scrollbar ¸¦ Á¦¿ÜÇÑ ¿µ¿ª¿¡¼ÀÇ mouseÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>clientY</TD> <TD class=syntaxRightCell>â Å׵θ®¿Í scrollbar ¸¦ Á¦¿ÜÇÑ ¿µ¿ª¿¡¼ÀÇ mouseÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>ctrlKey</TD> <TD class=syntaxRightCell>ctrl Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR> <TD class=syntaxLeftCell>keyCode</TD> <TD class=syntaxRightCell>Keyboard ¹®ÀÚÀÇ <A href="http://www.cadvance.org/doc/css/pseudo/iso-latin-1.asp" target=_blank>Unicode(ISO-Latin-1 character set)</A> °ª return</TD></TR> <TR> <TD class=syntaxLeftCell>offsetX</TD> <TD class=syntaxRightCell>event °¡ ¹ß»ýÇÏ´Â box(object) ÁÂÃø »ó´Ü¿¡ ´ëÇÑ mouse cursorÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>offsetY</TD> <TD class=syntaxRightCell>event °¡ ¹ß»ýÇÏ´Â box(object) ÁÂÃø »ó´Ü¿¡ ´ëÇÑ mouse cursorÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>screenX</TD> <TD class=syntaxRightCell>»ç¿ëÀÚ ¸ð´ÏÅÍ¿¡ ´ëÇÑ mouse cursorÀÇ X »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>screenY</TD> <TD class=syntaxRightCell>»ç¿ëÀÚ ¸ð´ÏÅÍ¿¡ ´ëÇÑ mouse cursorÀÇ Y »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>shiftKey</TD> <TD class=syntaxRightCell>shift Key°¡ ´·Á Á³´ÂÁöÀÇ ¿©ºÎ return (´·ÁÁ³À¸¸é true, ¾Æ´Ï¸é false)</TD></TR> <TR> <TD class=syntaxLeftCell>srcElement</TD> <TD class=syntaxRightCell>event°¡ ¹ß»ýÇÏ´Â element return</TD></TR> <TR> <TD class=syntaxLeftCell>x</TD> <TD class=syntaxRightCell>»ó´ë À§Ä¡·Î positioning (position:relative;) µÈ 1 ´Ü°è »óÀ§ element ¿¡ ´ëÇÑ mouse cursorÀÇ x »ó´ë ÁÂÇ¥</TD></TR> <TR> <TD class=syntaxLeftCell>y</TD> <TD class=syntaxRightCell>»ó´ë À§Ä¡·Î positioning (position:relative;) µÈ 1 ´Ü°è »óÀ§ element ¿¡ ´ëÇÑ mouse cursorÀÇ y »ó´ë ÁÂÇ¥</TD></TR></TBODY></TABLE><!-- »ç¿ë¹ý µé¾î°¡´Â Å×ÀÌºí ³¡--><BR><BR> <HR class=grayHr> <BR><B>shiftKey, ctrlKey, altKey</B> <P class=mtext>shiftKey, ctrlKey, altKey °¡ ´·ÁÁø »óÅÂÀÎÁö ¾Æ´ÑÁö¸¦ true(1), false(0) °ªÀ¸·Î return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â div ½ÃÀÛ --><B>¿¹Á¦</B> <DIV class=input id=shift_ctrl_alt><html><BR><head><BR><title>shiftKey, ctrlKey, altKey</title><BR><script type="text/javascript"><BR><!--<BR>function shiftKeyPressed(){<BR>if (event.<B>shiftKey</B>==1){<BR>alert("shift key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("shift key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR><BR>function ctrlKeyPressed(){<BR>if (event.<B>ctrlKey</B>==1){<BR>alert("ctrl key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("ctrl key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR><BR>function altKeyPressed(){<BR>if (event.<B>altKey</B>==1){<BR>alert("alt key °¡ ´·ÁÁø »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>else<BR>{<BR>alert("alt key °¡ ´·ÁÁöÁö ¾ÊÀº »óÅÂÀÔ´Ï´Ù.!")<BR>}<BR>}<BR>// --><BR></script><BR></head><BR><body><BR><div style="width:100%; height:150px;background-color:tomato;"<BR>onmousedown="shiftKeyPressed();">shift Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR><div style="width:100%; height:150px;background-color:royalblue;"<BR>onmousedown="ctrlKeyPressed();">ctrl Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR><div style="width:100%; height:150px;background-color:palegreen;"<BR>onmousedown="altKeyPressed();">alt Key¸¦ ´©¸£°í Ŭ¸¯ ¶Ç´Â ´©¸£Áö ¾Ê°í Ŭ¸¯ÇØ º¸¼¼¿ä.</div><BR></body><BR></html> </DIV><!-- ÀÔ·Â div ³¡--><BR><BR><A href="javascript:copy2Clipboard(shift_ctrl_alt);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>button</B> <P class=mtext>½ÇÇà ÇÑ ÈÄ¿¡ ¿À¸¥ÂÊ ¹öưÀ» ´·¯ º¸°í event.button == 2 ¿¡¼ 2¸¦ 1 ~ 7 »çÀÌÀÇ ¼ö¸¦ ¹Ù²Ù¾î ÀÔ·ÂÇÏ°í ½ÃÇèÇØ º¸¼¼¿ä... µ¿½Ã¿¡ ´©¸£´Â °æ¿ì ¹öư 2°³¸¦ °°Àº ¼ø°£¿¡ ´·¯¾ß µÈ´Ù´Â ¶æÀÌ ¾Æ´Ï¶ó 2°³°¡ ´·Á Áö±â¸¸ ÇÏ¸é µÈ´Ù´Â ¶æÀÔ´Ï´Ù. ½Ã°£ ¸ÂÃç¼ °°ÀÌ ´©¸¦¶ó°í ¾Ö¾²Áö ¸¶½ÃÁ®...</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B class=pos>ÀÔ·Â</B> <PRE class=input id=button_2><html> <head> <title>button</title> <script type="text/javascript"> <!-- function button_2(){ if (event.button == 2) {alert ("¿À¸¥ÂÊ button À» ´·¶½À´Ï´Ù.")} } // --> </script> </head> <body onmousedown="button_2();"> ¿À¸¥ÂÊ ¹öưÀ» ´©¸£½ÃÁ®... ±×¸®°í event.button == 2 ¿¡¼ 2¸¦ 1 ~ 7 »çÀÌÀÇ ¼ö¸¦ ¹Ù²Ù¾î ÀÔ·ÂÇÏ°í ½ÃÇèÇØ º¸¼¼¿ä... </body> </html> </PRE><!-- ÀÔ·Â pre ³¡--><A href="javascript:copy2Clipboard(button_2);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>srcElement, keyCode</B> <P class=mtext>srcElement´Â event°¡ ¹ß»ýÇÏ´Â ¹°Ã¼(object)ÀÇ Á¤º¸¸¦ return Çϰí, keyCode ´Â Keyboard ¹®ÀÚÀÇ <A href="http://www.cadvance.org/doc/css/pseudo/iso-latin-1.asp" target=_blank>Unicode</A> °ª(¼ýÀÚ)À» return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B class=pos>ÀÔ·Â</B> <PRE class=input id=srcElement_keyCode><html> <head> <title>srcElement, keyCode</title> <script type="text/javascript"> <!-- function whichButton(){ alert(event.keyCode) } function whichElement(){ tag_Name = event.srcElement.tagName tag_ID = event.srcElement.id alert("³ª´Â " + tag_Name + " element À̰í, id´Â " + tag_ID + " ÀÔ´Ï´Ù.") } // --> </script> </head> <body id="main" onkeyup="whichButton()" onclick="whichElement()"> ¸ÕÀú Ŭ¸¯À» ÇÑ ÈÄ¿¡ Keyboard¸¦ ´·¶´Ù ¶¼¸é Unicode °ªÀÌ alert â¿¡ ³ª¿À°Ô µË´Ï´Ù.<br /> Áï, â¿¡ focus°¡ µé¾î ¿Â »óÅ¿¡¼¸¸ OnKeyUp ÀÌ ¸Ô½À´Ï´Ù. <p id="para">p ÀÔ´Ï´Ù.</p> <div id="box">div ÀÔ´Ï´Ù.</div> <span id="inline">span ÀÔ´Ï´Ù.</span><br /> <button type="button" id="btn">button ÀÔ´Ï´Ù.</button> </body> </html> </PRE><!-- ÀÔ·Â pre ³¡--><A href="javascript:copy2Clipboard(srcElement_keyCode);open_window('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR> <HR class=grayHr> <BR><B>offsetX, offsetY</B> <P class=mtext>offsetX, offsetY ´Â Àý´ëÀ§Ä¡(absolute)·Î positioning µÈ boxÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ mouseÀÇ X¿Í YÀÇ ÁÂÇ¥¸¦ return ÇØ ÁÝ´Ï´Ù.</P><!-- ÀÔ·Â pre ½ÃÀÛ --><B>ÀÔ·Â</B> <DIV class=input id=offset_xy><html><BR><head><BR><title>offsetX, offsetY</title><BR><script type="text/javascript"><BR><!--<BR>function offsetCoords() {<BR>var offsetInfo = ""<BR>offsetInfo = "offsetX : " + window.event.<B>offsetX</B> + "r"<BR>offsetInfo += "offsetY : " + window.event.<B>offsetY</B> + "r"<BR>alert(offsetInfo);<BR>}<BR><BR>function offsetStatus(){<BR>window.status = "X = " + window.event.<B>offsetX</B> + " Y = " + window.event.<B>offsetY</B><BR>} <BR>// --><BR></script><BR></head><BR><body onmousemove="offsetStatus()" ondblclick="offsetCoords();"><BR>mouse cursor°¡ box ¹Û¿¡ ÀÖÀ» ¶§´Â âÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ »ó´ëÁÂÇ¥°¡ status bar¿¡ Ç¥½ÃµÇ°í<BR>bouble Click Çϸé alert â¿¡ x, y ÁÂÇ¥°¡ ¶ß°í, box ¼ÓÀ¸·Î µé¾î°¡¸é boxÀÇ ÁÂÃø »ó´ÜÀ» ±âÁØÀ¸·Î ÇÑ »ó´ëÁÂÇ¥°¡ Ç¥½ÃµÇ°í, click Çϸé alert â¿¡ x, y ÁÂÇ¥°¡ Ç¥½Ã µË´Ï´Ù.<BR><DIV onclick="offsetCoords();" STYLE="width:200; height:200; background-color:gray; position:absolute; top:100; left:200; color:gold;"><BR>ÀÌ DIV box´Â top:100px, left:300px À§Ä¡¿¡ position:absolute·Î positioning µÈ box ÀÔ´Ï´Ù.<BR></DIV><BR></body><BR></html> </DIV><!-- ÀÔ·Â pre ³¡--><BR><BR><A href="javascript:copy2Clipboard(offset_xy);open_window2('../../../include/code_executor.asp');"><IMG alt="ÄÚµå ½ÇÇà Çϱâ" src="http://www.cadvance.org/doc/images/icon/exec_button.gif" border=0></A><BR><BR><BR> <HR class=blackHr>
÷ºÎÆÄÀÏ
°ßÀû°è»êÇϱâ
ÀÛ¾÷ÀÇ·Ú
°ßÀû¹®ÀÇ
°øÁö»çÇ×