À̺¥Æ® Äڵ带 HTML ¼Ó¿¡ »ðÀÔÇϰųª Javascript·Î »ðÀÔÇϸé, ¿¹¸¦ µé¾î ´ÜÃ߸¦ ´©¸¥´Ù°Å³ª ¸¶¿ì½º¸¦ À̵¿½ÃÅ°´Â µî¿¡ ÀÇÇÏ¿©, ¾î¶² À̺¥Æ®¸¦ ¹ß»ý ½ÃÄÑ Ãß°¡ÀûÀÎ ÀÛ¾÷À» ½ÇÇàÇÏ°Ô ÇÒ ¼ö ÀÖÀ¸¹Ç·Î ´ë´ÜÈ÷ À¯¿ëÇÏ´Ù. »ç¿ë¿¡ ÀÖ¾î HTML ¼Ó¼º°ú JavaScript ÄÚµåÀ» ±¸º°ÇÏ¿©¾ß ÇÑ´Ù. HTML ¼Ó¼ºHTMLeventHandler='JavascriptCode'
ÁÖÀÇÇÒ Á¡Àº <SCRIPT language=javaSCRIPT></SCRIPT> ¼ÓÀÌ ¾Æ´Ï¶ó HTML ÅÂ±× ¼Ó HTMLeventHandler(À̺¥Æ®Ã³¸®ÀÚ)À̹ǷΠJavascript Äڵ尡 ¾Æ´Ï¶ó HTML ¼Ó¼ºÀ̶ó´Â Á¡ÀÌ´Ù. ±×·¯³ª µû¿ÈÇ¥ ¼ÓÀÇ ³»¿ëÀº ½ºÅ©¸³Æ®·Î °£ÁÖµÇ°í ½ºÅ©¸³Æ® ¾ð¾î ¸í½Ã°¡ ¾øÀ¸¸é Javascript ·Î Çؼ®µÈ´Ù. HTML¼Ó¼ºÀ̹ǷΠ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏÁö ¾Ê¾Æ onMouseOver, onmouseover, ONMOUSEOVER ¸ðµÎ µ¿ÀÏÇÏ°Ô »ç¿ëµÉ ¼ö ÀÖ´Ù. <FORM><INPUT type="button" value="Ŭ¸¯ÇØ º¸¶ó." onClick="alert('¾È³çÇϼ¼¿ä!')"></FORM>
Javascript ÄÚµåobject.onclick='JavascriptCode'
±×·¯³ª Javascript °³Ã¼ À̺¥Æ®Ã³¸®ÀÚ´Â ¸ðµÎ ¼Ò¹®ÀÚÀÌ°í, ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏ¿© ´ë¼Ò¹®ÀÚ°¡ Ʋ¸®¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù. <FORM name="form1"><TABLE border=0 width=100%><TR> <TD width=250><DIV style=white-space:nowrap> <INPUT type="button" name="button1" value="¸¶¿ì½º¸¦ ´·¯ º¸¶ó" onClick="timer=window.setInterval('clock()',50);"> <INPUT type=button value="ŸÀÌ¸Ó ÁßÁö" onClick="if (timer) window.clearInterval(timer)"></DIV></TD> <TD width=20 id="secArea"> <! ÃÊ Ç¥½Ã À§Ä¡></TD> <TD width=60 span id="imagearea"> <! À̹ÌÁö Ç¥½Ã À§Ä¡></TD> <TD width=210 span id="Clock" style=white-space:nowrap;font-size:9pt;vertical-align:bottom> <! ½Ã°¢ Ç¥½Ã À§Ä¡></TD> </TR></TABLE></FORM> <SCRIPT> var timer=''; function Call(numb){ // À̹ÌÁö º´È½ÃÅ°´Â ±â´ÉÇÔ¼ö ½ÃÀÛ if (numb){ // ¸¶¿ì½º ´©¸¥ È¿°ú¸¦ ¹ß»ý½ÃŲ´Ù form1.button1.onmousedown=imagearea.innerHTML='<IMG src="../../../gif/rfexample.gif">'; } else{ // ¸¶¿ì½º ´·µ´Ù ³õÀº È¿°ú¸¦ ¹ß»ý½ÃŲ´Ù form1.button1.onmouseup=imagearea.innerHTML=' '; }; } // À̹ÌÁö º¯È½ÃÅ°´Â ±â´ÉÇÔ¼ö Á¾·á function clock(){ // ŸÀÌ¸Ó ±â´ÉÇÔ¼ö ½ÃÀÛ now=new Date(); // ÇöÀç ½Ã°¢À» ¾ò¾î now¿¡ ÇÒ´çÇÑ´Ù second=secArea.innerHTML=now.getSeconds(); // now¿¡¼ Ãʸ¦ ¾ò¾î second¿¡ ÇÒ´çÇÏ°í Ãâ·ÂÇÑ´Ù Clock.innerHTML=now.toLocaleString(); // nowÀÇ ½Ã°¢ÀÇ ¹®ÀÚ¿À» ¾ò¾î Ãâ·ÂÇÑ´Ù Call(second%2); // Ãʸ¦ 2·Î ³ª´« ³ª¸ÓÁö¸¦ Àμö·Î ±â´ÉÇÔ¼ö¸¦ È£ÃâÇÑ´Ù. 0Àº ¦¼ö, 1Àº Ȧ¼ö } // ŸÀÌ¸Ó ±â´ÉÇÔ¼ö Á¾·á </SCRIPT> Javascript À̺¥Æ®Ã³¸®ÀÚ´Â ÇØ´ç º° À̺¥Æ®¸¦ Âü°íÇ϶ó. ¿©±â¼´Â º°·Î ¼³¸íÇÑ´Ù. |