¿©±â¼­ this´Â ÀÔ·ÂÆû(form) form1À» ÁöĪÇÏ°í, ¼Û½ÅµÇ¸é(onsubmit) ±× ÀÔ·ÂÆûÀÇ ¼Ò¼ÓÀÇ ÀÔ·Â Çʵ忡¼­ in1 °ú in2 ÀÇ °ª(.value)À» °áÇÕÇÏ¿© °æ°í¸¦ º¸³½´Ù. ¹®ÀÚ \nÀº °æ°í¿¡¼­ ÁÙ¹Ù²Þ Ç϶ó´Â °Í.

¸®¼Â(reset)Àº ÇØ´ç ÀÔ·ÂÆû(form)ÀÇ ³»¿ëÀ» ¸ðµÎ ÃʱⰪÀ¸·Î ȯ¿øÇÑ´Ù. À̺¥Æ® onreset¸¦ ÀÌ¿ëÇÏ¿© ´Ù¸¥ ÀÓ¹«¸¦ ¼öÇ൵ ½Ãų ¼ö ÀÖ´Ù.

<A name=example1></A>
<FORM name="form1" action=#example1
  onSubmit="alert('¼Û½ÅµË´Ï´Ù.\n'+this.in1.value+' '+this.in2.value)"
  onReset="alert('ÀÔ·ÂÆûÀÌ ¿ø»óÅ·Πȯ¿øµË´Ï´Ù')">
<INPUT type="text" name="in1" value="¾È³çÇϼ¼¿ä"><BR>
<INPUT type="text" name="in2" value="KoXo Javascript ÀÔ´Ï´Ù."><BR>
<INPUT type="submit" value="¼Û½Å(submit)"> <INPUT type="reset" value="´Ù½Ã(reset)"><BR>
</FORM>

<SCRIPT>document.onload=form1.in2.select() // ¹®¼­°¡ ·ÎµùµÇ¸é ÇØ´ç Çʵ带 ¼±ÅÃ(select)</SCRIPT>

°°Àº ³»¿ëÀÇ À̺¥Æ®¸¦ ¼Û½Å´ÜÃß¿Í ¸®¼Â´ÜÃß¿¡ onclick À̺¥Æ®¸¦ ÀÌ¿ëÇÏ¿© ÁÙ ¼ö ÀÖ´Ù.




<FORM name="form2" action="#example1">
<INPUT type="text" name="in1" value="¾È³çÇϼ¼¿ä"><BR>
<INPUT type="text" name="in2" value="KoXo Javascript ÀÔ´Ï´Ù."><BR>
<INPUT type="submit" value="¼Û½Å" onClick="alert('¼Û½ÅµË´Ï´Ù.\n'+this.in1.value+' '+this.in2.value)"
<INPUT type="reset" value="´Ù½Ã" onClick="alert('ÀÔ·ÂÆûÀÌ ¿ø»óÅ·Πȯ¿øµË´Ï´Ù')"><BR>
</FORM>

¼öÁ¤ ÈÄ ÃÊÁ¡À» ¿ÜºÎ·Î À̵¿½ÃÄÑ¾ß ÇÑ´Ù.

<FORM name="formchange">
<INPUT type="text" name="inchange" value="³»¿ëÀ» ¼öÁ¤ÇØ º¸½Ã¿À." onChange="alert('['+this.value+']·Î ¼öÁ¤µÇ¾ú½À´Ï´Ù.')">
</FORM>

¼Û½ÅµÇ¸é ÆäÀÌÁö¸¦ ÀÌÅ»ÇϹǷΠºÎÀ§ ÁöÁ¤ÀÚ(target="example3")·Î ÇöÀ§Ä¡·Î ´Ù½Ã ¿À°Ô Çß´Ù.

<SCRIPT>
function getValue(){
  len=form3.sel1.length; // ¼±Åà »çÇ×ÀÇ °¹¼ö¸¦ »êÁ¤ÇÑ´Ù.

for (i=0;i<=len;i++){
    if (form3.sel1[i].selected){  // ¼±Åà »çÇ× ¸ñ·Ï Áß ¼±ÅÃµÈ ³»¿ëÀ» ¹ßÃéÇÑ´Ù.
      if (i=='0') color='pink'
      if (i=='1') color='yellow'
      if (i=='2') color='aqua'
      if (i=='3') color='lightgreen'
      if (i=='4') color='orange';
      alert('¼±ÅÃµÈ »ö»óÀº '+color+' ÀÔ´Ï´Ù');
    }
  }
/* alert('¼±ÅÃµÈ »ö»óÀº '+form3.sel1.options[form3.sel1.selectedIndex].value+' ÀÔ´Ï´Ù');
   °£´ÜÇÏ°Ô ±â´ÉÇÔ¼öÇÔ¼ö ³»¿ë Àüü¸¦ ÀÌ°ÍÀ¸·Î ´ëüÇÒ ¼ö ÀÖ´Ù. */
} </SCRIPT> <A name=example3></A> <!¼Û½ÅÈÄ ´Ù½Ã ã¾Æ¿Ã ºÎÀ§ ÁöÁ¤ÀÚ> <FORM name="form3" onSubmit="getValue()" action="#example3"> <!A href=#example3 ¿¡ ÇØ´ç> <SELECT name="sel1"> <OPTION value="pink">pink</OPTION> <OPTION value="yellow">yellow</OPTION> <OPTION value="aqua" selected>aqua</OPTION> <OPTION value="lightgreen">lightgreen</OPTION> <OPTION value="orange">orange</OPTION> </SELECT> <INPUT type="submit" value="¼Û½Å"><INPUT type="reset" value="´Ù½Ã"> </FORM>
ÀÔ·ÂÄ­¿¡¼­ ¹®ÀÚ¸¦ ¼±ÅÃÇØ º¸¶ó.



this.value´Â ÇØ´ç °³Ã¼ÀÇ °ª, msg ´Â ±â´ÉÇÔ¼ö¸¦ È£ÃâÇÒ ¶§ ¹ÞÀº °ª

<SCRIPT>function showit(msg){alert(msg+' ¼±ÅÃÇß½À´Ï´Ù')}</SCRIPT>;

<FORM name="f3">ÀÔ·ÂÄ­¿¡¼­ ¹®ÀÚ¸¦ ¼±ÅÃÇØ º¸¶ó<BR>
<INPUT type="text" size=4 name="i1" onSelect="showit(this.value)" value="û»ö"><BR>
<INPUT type="text" size=4 name="i2" onSelect="showit(this.value)" value="³ë¶û"><BR>
<INPUT type="text" size=4 name="i3" onSelect="showit(this.value)" value=="³ì»ö"><BR>
</FORM>