Tel. 042-353-2371

ÆòÀÏ ¿ÀÀü 9½Ã ~ ¿ÀÈÄ 7½Ã
±â¾÷ÀºÇà

010-8649-6758

¿¹±ÝÁÖ:Á¦ÁÖ»ç¶û(¼ÛÁø¾Æ)
JAVASCRIPT
Ȩ > ȨÆäÀÌÁöÁ¦ÀÛ±³½Ç > JAVASCRIPT

Ä«Å×°í¸® Object
Á¦¸ñ Form design I
ÀÛ¼ºÀÚ freewebkorea
ÀÛ¼ºÀÏÀÚ 2009-12-09
Á¶È¸¼ö 1698

form °ü·Ã HTML Elements

ÀÌ ¹ø ÆäÀÌÁö¿¡¼­´Â FormÀ» À§Çؼ­ ¸¸µç Element¶ó°í ÇØµµ °ú¾ðÀÌ ¾Æ´Ò Label, Fieldset, Legend Element¿¡ ´ëÇØ ¾Ë¾Æ º¸°Ú½À´Ï´Ù. ÀÌ ElementµéÀº Form À» º¸±â ÁÁ°Ô ²Ù¸ç ÁÙ »Ó¸¸ ¾Æ´Ï¶ó, °°Àº Á¾·ùÀÇ ÀÔ·Â field ³¢¸® ¹­¾î¼­ Á¦¸ñÀ» ºÙ¿© ÁֹǷÎÇØ¼­ ±¸ºÐÀ» ´õ¿í ½±°Ô ÇØ ÁÝ´Ï´Ù. º¸±â ÁÁÀº ¶±ÀÌ ¸Ô±âµµ ÁÁ´Ù. ¶Ç´Â ±â¿ÕÀÌ¸é ´Ùȫġ¸¶´Ù... ¸Ó ÀÌ·± ¸»µµ ÀÖÁö ¾Ê½À´Ï±î.
legend : optional, forbidden, empty, deprecated, loose dtd, frameset dtd  [Ç¥ º¸´Â ¹æ¹ý]
element start tag end tag empty deprecated dtd
LABEL          
FIELDSET          
LEGEND          
BUTTON          


Label Element
accesskey alt key¿Í ÇÔ²² ´­·¯¼­ for·Î ÁöÁ¤ÇÑ id¸¦ °¡Áø ÀԷ¶õ¿¡ Á¢±Ù(access : text ÀԷ¶õ¿¡´Â focus¸¦ ¸ÂÃß°í, radio¿Í checkbox´Â ¼±ÅÃ) ÇÒ ¼ö ÀÖ°Ô ÇØÁÖ´Â ¿µ¹®ÀÚ 1 ±ÛÀÚ(key).
for accesskeyÀÇ ´ë»óÀÌ µÉ ÀԷ¶õÀÇ id
°øÅë ¼Ó¼º dir, id, class, style, title, ¹ß»ýÇÏ´Â Event´Â °øÅë ¼Ó¼ºÇ¥ ¸¦ ÂüÁ¶
sample ¾Æ·¡ÀÇ ÀԷ¶õ ¿· ¹ØÁÙÄ£ ¿µ¹®ÀÚ¸¦ alt key¸¦ ´©¸¥Ã¤ Âï¾î º¸¼¼¿ä. ¶Ç text ÀԷ¶õ, radio button, checkbox¸¦ Á÷Á¢ Ŭ¸¯ÇÏÁö ¸»°í, label·Î ÁöÁ¤ÇÑ ±ÛÀÚ¸¦ ´­·¯º¸¸é ´Ü¾î¿¡ focus(Á¡¼± Å׵θ®)°¡ »ý±â¸é¼­ ÇØ´ç ÀԷ¶õÀ» Ŭ¸¯ÇÑ °Í°ú °°Àº È¿°ú°¡ ÀÖ½À´Ï´Ù. U Element¸¦ »ç¿ëÇÏ¿© ¹ØÁÙÀ» Ãļ­ accesskey°¡ ¹ºÁö ´ç¿¬È÷ Ç¥½Ã ÇØ¾ß µÇ°í, ¾Æ·¡¿Í °°ÀÌ style="cursor:hand;"·Î Ŭ¸¯À» À¯µµÇϰï ÇÏÁö¿ä...^^

***°°Àº accesskey¸¦ µÎ¹ø ÀÌ»ó »ç¿ëÇϸé óÀ½ »ç¿ëÇÑ accesskey¸¸ ¸Ô½À´Ï´Ù.



Source code
<form>
<input type="text" id="txt" />
<label accesskey="i" for="txt" style="cursor:hand;"><u>I</u>nput</label>
<input type="checkbox" id="chk" />
<label accesskey="c" for="chk" style="cursor:hand;"><u>C</u>heck</label>
<input type="radio" id="man" name="sex" />
<label accesskey="m" for="man" style="cursor:hand;"><u>M</u>an</label>
<input type="radio" id="woman" name="sex" />
<label accesskey="w" for="woman" style="cursor:hand;"><u>W</u>oman</label>
</form>




Fieldset Element, Legend Element

Fieldset Element´Â ¾Æ·¡ÀÇ ¿¹¿Í °°ÀÌ fieldset ¾È¿¡ ÀÖ´Â ElementµéÀ» Å׵θ®·Î ¹­¾î ÁÖ´Â ´Ü¼øÇÑ ¿ªÇÒÀ» ÇØ ÁÝ´Ï´Ù. Legend Element´Â Á¦¸ñÀÌ µÇ°Ú±¸¿ä... µû¶ó¼­ fieldsetÀº °øÅë ¼Ó¼º¸¸À¸·Î °¡Áö°í ÀÖ°í, Legend´Â ¼öÆò Á¤·Ä(align: left, center, right) ¼Ó¼ºÀ» °¡Áö°í ÀÖ½À´Ï´Ù.
Fieldset°ú Legend

Fieldset°ú Legend <FORM> </FORM>
Source code
<html>
    <head>
        <title>Fieldset°ú Legend</title>
    </head>
    <body>
      <form>
      <fieldset>
      <legend>Fieldset°ú Legend</legend>
        <input type="text" id="txt" />
        <label accesskey="i" for="txt" style="cursor:hand;"><u>I</u>nput</label>
        <input type="checkbox" id="chk" />
        <label accesskey="c" for="chk" style="cursor:hand;"><u>C</u>heck</label>
        <input type="radio" id="man" name="sex" />
        <label accesskey="m" for="man" style="cursor:hand;"><u>M</u>an</label>
        <input type="radio" id="woman" name="sex" />
        <label accesskey="w" for="woman" style="cursor:hand;"><u>W</u>oman</label>
      </fieldset>    
      </form>
    </body>
</html>




tabindex Attribute

À¥ ÆäÀÌÁö »ó¿¡¼­ ¸µÅ©³ª ÀԷ¶õ ÀÌ ÀÖ´Â °æ¿ì ¸¶¿ì½º¸¦ »ç¿ëÇÏÁö ¾Ê°í Tab key¸¦ ´­·¯ Ç׸ñÀ¸·Î À̵¿ÇÒ ¼ö ÀÖÀ¸¸ç, ±× ¼ø¼­´Â Source¸¦ CodingÇÑ ¼ø¼­¸¦ µû¸£°Ô µË´Ï´Ù. ÇÏÁö¸¸ °æ¿ì¿¡ µû¶ó¼­´Â Áß°£¿¡ °Ç³Ê ¶Ù°Ô ÇÒ Ç׸ñÀ̳ª ¼ø¼­¸¦ ÁöÁ¤ÇÒ ¼ö´Â ÀÖ½À´Ï´Ù. tabindex ¼Ó¼ºÀº A, AREA, BUTTON, INPUT, OBJECT, SELECT, TEXTAREA Tag µî¿¡¼­ Keyboard Tab Key¸¦ ´­·¯¼­ tabindex ¼Ó¼ºÀ¸·Î ÁöÁ¤ÇÑ Ç׸ñ °£À» À̵¿ ¶Ç´Â Á¡ÇÁ½ÃÄÑ ÁÖ´Â ¼Ó¼ºÀÔ´Ï´Ù. Tab°ú IndexÀÇ µÎ ´Ü¾î¸¦ ºÙ¿©³õÀº ¼ÀÀÌÁÒ. ¿äÁò ó·³ Mouse¸¦ ¸¹ÀÌ »ç¿ëÇÏ´Â »óȲ¿¡¼­ ÀÌ°Ô ¹«½¼ Çʿ䰡 ÀÖ°Ú³ª ÇϰÚÁö¸¸, Keyboard¿¡ Àͼ÷ÇÑ »ç¿ëÀڵ鿡°Ô´Â ¸Å¿ì Æí¸®ÇÑ ±â´ÉÀÔ´Ï´Ù. ¿À·£ ÀÛ¾÷À» ÇÏ´Ù º¸¸é ¸¶¿ì½º¸¦ Àâ¾Ò´Ù ³õ¾Ò´Ù ÇÏ´Â°Ô ¹«Áö ±ÍÂú°Åµç¿ä. ¿µ¾î±Ç ±¹°¡¿¡¼­ ¸¹ÀÌ »ç¿ëÇѴٴ±º¿ä.

W3CÀÇ spec¿¡ ÀÇÇϸé 0 ~ 32767 ±îÁöÀÇ Á¤¼ö°¡ »ç¿ë °¡´ÉÇϸç ÀÌ¿ÜÀÇ ¼ýÀÚ´Â ¹«½ÃÇϰí, ºê¶ó¿ìÀú¿¡ µû¶ó '0' ÀÌ Ã¹ ¹øÂ° ÀÏ ¼öµµ ÀÖ°í ¸¶Áö¸·ÀÌ µÉ ¼öµµ ÀÖ´Ù°í ÇÕ´Ï´Ù. IE ¿¡¼­´Â '0' ÀÌ ¸¶Áö¸·À¸·Î ó¸® µË´Ï´Ù.

ÀÌ Ã³·³ ¼ýÀÚÀÇ »ç¿ë ÆøÀÌ Å©±â ¶§¹®¿¡ ÇϳªÀÇ ¿ä·ÉÀ» ¸»ÇØ ÁÖÀÚ¸é, 1, 2, 3, 4 ¿Í °°ÀÌ Numbering ÇÏÁö ¸»°í 10, 20, 30 °ú °°ÀÌ Áß°£¿¡ ¹øÈ£¸¦ ³²°Ü µÎ¸é Áß°£¿¡ »õ Ç׸ñÀ» Ãß°¡ÇØ¾ß ÇÒ Çʿ䰡 ÀÖÀ» ¶§ ´Ù¸¥ tabindex¸¦ ¼öÁ¤ÇÏÁö ¾Ê¾Æµµ µÇ°ÚÁ®? ÀÚ¼¼ÇÑ »ç¿ë¹ýÀº

  • ÀÏ´Ü Tab ¿¡ ÀÇÇØ ¼±ÅÃµÈ Ç׸ñÀº focus°¡ »ý±â°í
  • A, Area, Button °°ÀÌ Link °É¸° ±ÛÀÚ³ª ±×¸²ÀÇ °æ¿ì enter¸¦ Ä¡¸é ¸¶¿ì½º·Î Ŭ¸¯ÇÑ °Í°ú °°½À´Ï´Ù.
  • Input typeÀÌ textÀÎ °æ¿ì³ª Textarea ´Â ¹®ÀÚ ÀÔ·ÂÀ» ÇÏ¸é µÇ°ÚÁÒ.
  • Select - OptionÀÇ °æ¿ì »óÇÏ È­»ìÇ¥ Ű·Î ¼±ÅÃ
  • Input typeÀÌ radio, checkboxÀÎ °æ¿ì Spacebar·Î ¼±ÅÃ
  • µÚ·Î Ç׸ñÀ» À̵¿ÇÏ°í ½ÍÀ¸¸é shift + tab
ÀÔ·Â
<html>
<head>
<title>tabindex Attribute</title>
</head>
<body>
    <a href="#" tabindex="10">10</a><br />
    <a href="#" tabindex="11">11</a><br />
    <a href="#" tabindex="20">20</a><br />
    <form>
        <input type="checkbox" tabindex="30" />30<br />
        <input type="checkbox" tabindex="40" />40<br />
        <input type="radio" name="rad1" tabindex="50" />50<br />
        <input type="radio" name="rad2" tabindex="60" />60<br />
        <input type="radio" name="rad3" tabindex="70" />70<br />
        <input type="text" tabindex="-1" />-1<br />
        <input type="text" tabindex="0" />0<br />
        <textarea tabindex="80"></textarea>80<br />
        <button tabindex="90">90</button><br />
    </form>
</body>
</html>
ÄÚµå ½ÇÇà Çϱâ



Button Element

Button Element´Â Input typeÀÌ Button, submit, resetÀÇ 3°¡ÁöÀÎ °æ¿ì¿¡ ¸¸µé¾îÁö´Â Button°ú ºñ½ÁÇÏÁö¸¸ ¾à°£ÀÇ Â÷À̰¡ ÀÖ½À´Ï´Ù. ±× Â÷ÀÌ´Â

  • Button Element´Â End TagÀÌ ÇÊ¿äÇÏ´Ù´Â Á¡.
  • Button ¼Ó¿¡ ³»¿ë¹°(Contents)¸¦ ³ÖÀ» ¼ö ÀÖ´Ù´Â Á¡
  • accesskey ¸¦ ÁöÁ¤ÇÒ ¶§ ¹ØÁÙ(U TagÀ¸·Î)À» ³ÖÀ» ¼ö ÀÖ´Ù´Â Á¡. (Input ÀÇ °æ¿ì value °ªÀÌ Button¿¡ ³ªÅ¸³ª±â ¶§¹®¿¡ ¹ØÁÙÀ» ±×À» ¼ö ¾øÁ®)

ÀÌ¿Í °°ÀÌ Input Element¿Í ´Þ¸® ´õ ¸¹Àº È¿°ú¸¦ ³¾ ¼ö ÀÖ½À´Ï´Ù. ¿ì¼± ±×¸² ÆÄÀÏÀÌ µé¾î°£ ¿¹¸¦ Çϳª º¾½Ã´Ù.
Button Element
accesskey alt key¿Í ÇÔ²² ´­·¯¼­ for·Î ÁöÁ¤ÇÑ id¸¦ °¡Áø ÀԷ¶õ¿¡ Á¢±Ù(access : text ÀԷ¶õ¿¡´Â focus¸¦ ¸ÂÃß°í, radio¿Í checkbox´Â ¼±ÅÃ) ÇÒ ¼ö ÀÖ°Ô ÇØÁÖ´Â ¿µ¹®ÀÚ 1 ±ÛÀÚ(key).
tabindex tabindex attribute ÂüÁ¶
type button(Default), submit, reset ÀÇ 3°¡Áö type À̸ç INPUT ElementÀÇ type attribute ÂüÁ¶
disabled INPUT ElementÀÇdisabled attribute ÂüÁ¶
°øÅë ¼Ó¼º dir, id, class, style, title, ¹ß»ýÇÏ´Â Event´Â °øÅë ¼Ó¼ºÇ¥ ¸¦ ÂüÁ¶


IMG TagÀ» Æ÷ÇÔÇÑ Button



Source code

<body>
    <button onclick="location.href='mailto:webmaster@cadvance.org'" style="cursor:hand;">
        <b>Send E-mail</b>&nbsp;&nbsp;
        <img src="../images/icon/email.gif" align="absmiddle" alt="email (1K)" />
    </button>
</body>
ÄÚµå ½ÇÇà Çϱâ



Form collection ¼Ó¿¡¼­ »ç¿ë ÇÒ °æ¿ì

Button typeÀÌ submit ¶Ç´Â reset ÀÏ °æ¿ì ¹Ýµå½Ã Form collection(<form> ~ </form>) ¼Ó¿¡¼­ »ç¿ëÇÕ´Ï´Ù.
Source code

<body>
   <form action="http://somesite.com/prog/adduser" method="post">
      <P>
      First name: <input type="text" name="firstname"><br />
      Last name: <input type="text" name="lastname"><br />
      E-mail: <input type="text" name="email"><br />
      <input type="radio" name="sex" value="Male"> Male<br />
      <input type="radio" name="sex" value="Female"> Female<br />
      <button name="submit" value="submit" type="submit">
      <u>S</u>end 
      <img align="absmiddle" src="../../images/login_icon/login_button.gif" alt="login (1K)" />
      </button>  		
      <button name="reset" type="reset">
      <u>R</u>eset 
      <img align="absmiddle" src="../../images/login_icon/reset.gif" alt="register (1K)" />
      </button>
      </P>
   </form>
</body>
ÄÚµå ½ÇÇà Çϱâ