ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [HTML] ํผ ๊ด€๋ จ ํƒœ๊ทธ์™€ ์˜ˆ์ œ - 1
    ๐ŸŒ FrontEnd/HTML & CSS 2022. 5. 15. 16:10

     

    ํผ ๊ด€๋ จ ํƒœ๊ทธ๋“ค

    ํผ๊ณผ ๊ด€๋ จ๋œ ํƒœ๊ทธ๋“ค์„ ๊ณต๋ถ€ํ•ด๋ด…์‹œ๋‹ค.

     

     

    1. ํผ

    (1) ํผ(form)์ด๋ž€?

    • ์‚ฌ์šฉ์ž๊ฐ€ ์›น ํŽ˜์ด์ง€์— ์–ด๋–ค ์ •๋ณด(๊ฐ’) ์„ ์ž…๋ ฅํ–ˆ์„ ๋•Œ ๊ทธ ์ •๋ณด๋ฅผ ์„œ๋ฒ„์— ์ „๋‹ฌํ•˜๊ณ ์ž ํ•  ๋•Œ ํผ์„ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค.
    • ์ฆ‰ ์‚ฌ์šฉ์ž์˜ ๊ฐ’์„ ์„œ๋ฒ„์— ์ „๋‹ฌํ•ด์ฃผ๋Š” ์ผ์„ ํ•ฉ๋‹ˆ๋‹ค.

     

    (2) <form> ํƒœ๊ทธ - ํผ ๋งŒ๋“ค๊ธฐ

    • ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์†์„ฑ
      • method : ํผ์„ ์ „์†กํ•  ๋ฐฉ์‹ ์„ ํƒ
      • name : ํผ์„ ์‹๋ณ„ํ•˜๊ธฐ ์œ„ํ•œ ํผ์˜ ์ด๋ฆ„
      • action : ํผ์„ ์ „์†กํ•  ์„œ๋ฒ„ ์ชฝ์˜ ์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ
      • target : action ์—์„œ ์ง€์ •ํ•œ ์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ์„ ํ˜„์žฌ ์ฐฝ์ด ์•„๋‹Œ ๋‹ค๋ฅธ ์œ„์น˜์— ์—ด๋„๋ก ์ง€์ •

     

    • autocomplete ์†์„ฑ : ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ–ˆ๋˜ ๋‚ด์šฉ์„ ๊ธฐ์–ตํ–ˆ๋‹ค๊ฐ€ ๋น„์Šทํ•œ ๋‚ด์šฉ์„ ์ž…๋ ฅํ•  ๊ฒฝ์šฐ, ์ด์ „์— ์ž…๋ ฅํ–ˆ๋˜ ๋‚ด์šฉ์„ ํžŒํŠธ๋กœ ๋ณด์—ฌ์ฃผ๋Š” ์†์„ฑ์ž…๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <form [์†์„ฑ="์†์„ฑ ๊ฐ’"]> ํผ ์š”์†Œ </form>

     

    (2) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>form</title>
    </head>
    <body>
        <form action="serch.php" method="post">
            <input type="text" title="๊ฒ€์ƒ‰">
            <input type="submit" value="๊ฒ€์ƒ‰">
        </form>
    </body>
    </html>

     

    (3) <label> ํƒœ๊ทธ - ํผ ์š”์†Œ์— ๋ ˆ์ด๋ธ” ๋ถ™์ด๊ธฐ

    • ํผ ์š”์†Œ์— ๋ ˆ์ด๋ธ”(ํ…์ŠคํŠธ)์„ ๋ถ™์ด๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค.
    • ๋ผ๋””์˜ค ๋ฒ„ํŠผ์ด๋‚˜ ์ฒดํฌ ๋ฐ•์Šค์—์„œ ๋ ˆ์ด๋ธ” ๋ถ€๋ถ„์„ ํด๋ฆญํ•ด๋„ ๋ผ๋””์˜ค ๋ฒ„ํŠผ๊ณผ ์ฒดํฌ ๋ฐ•์Šค ๋ฒ„ํŠผ์ด ์„ ํƒ๋ฉ๋‹ˆ๋‹ค.
    • ๋ผ๋””์˜ค ๋ฒ„ํŠผ์ด๋‚˜ ์ฒดํฌ ๋ฐ•์Šค์™€ ์—ฐ๊ฒฐํ•ด ๋‘์—ˆ๋‹ค๋ฉด ํ…์ŠคํŠธ๋งŒ ํ„ฐ์น˜ํ•ด๋„ ์„ ํƒ๋˜๊ธฐ ๋•Œ๋ฌธ์—, ์‚ฌ์šฉ์ด ํ›จ์”ฌ ํŽธ๋ฆฌํ•ด์ง‘๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <label [์†์„ฑ="์†์„ฑ ๊ฐ’"]> ๋ ˆ์ด๋ธ” <input ...> </label>
    •              <label for="id ์ด๋ฆ„"> ๋ ˆ์ด๋ธ” </label>
    •              <input id="id ์ด๋ฆ„ [์†์„ฑ="์†์„ฑ ๊ฐ’"]>

     

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>์•„์ด๋Œ ๋งŒ๋“ค๊ธฐ</title>
        <style>
            ul {
                list-style: none;
            }
    
            li {
                margin: 20px;
            }
        </style>
    </head>
    <body>
        <form>
            <h3>์•„์ด๋Œ ์ปจ์…‰ ์ •ํ•˜๊ธฐ (์ค‘๋ณต ์„ ํƒ ๊ฐ€๋Šฅ)</h3>
            <ul>
                <li><input type="checkbox" value="fresh">์ƒํผ</li>
                <li><input type="checkbox" value="sexy">์„น์‹œ</li>
                <li><input type="checkbox" value="hip">ํž™ํ•ฉ</li>
            </ul>
            <h3>์•„์ด๋Œ ๋Šฅ๋ ฅ ์ •ํ•˜๊ธฐ (ํ•œ ๊ฐ€์ง€๋งŒ ์„ ํƒ ๊ฐ€๋Šฅ)</h3>
            <ul>
                <li><label><input type="radio" name="ability" value="voice">ํƒ€ํŒฌ๋“ค๋„ ์ธ์ •ํ•˜๋Š” ๋ผ์ด๋ธŒ ์‹ค๋ ฅ</label></li>
                <li><label><input type="radio" name="ablility" value="dance">๋„‹์„ ๋†“๊ฒŒ ๋งŒ๋“œ๋Š” ์นผ๊ตฐ๋ฌด</label></li>
                <li><label><input type="radio" name="ability" value="concept">๊ทธ ๋ˆ„๊ตฌ์™€๋„ ๋‹ค๋ฅธ ์ƒ์ƒ์น˜๋„ ๋ชปํ•œ ์ปจ์…‰</label></li>
            </ul>
        </form>
    </body>
    </html>

     

    (4) <fieldset>, <legend> ํƒœ๊ทธ - ํผ ์š”์†Œ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ๊ธฐ

    • <fieldset> ํƒœ๊ทธ : ํผ ์š”์†Œ๋ฅผ ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค.
    • <legend> ํƒœ๊ทธ : ๊ทธ๋ฃน์œผ๋กœ ๋ฌถ์€ ๊ตฌ์—ญ์— ์ œ๋ชฉ์„ ๋ถ™์ด๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค.

     

    (4) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>ํฌ์ผ“๋ชฌ ๋„๊ฐ</title>
        <style>
            ul {
                list-style: none;
            }
    
            li {
                margin: 20px;
            }
    
            li label {
                width: 80px;
                float: left;
            }
    
            fieldset {
                margin: 15px;
            }
        </style>
    </head>
    <body>
        <form>
            <fieldset>
                <legend>ํฌ์ผ“๋ชฌ ๊ธฐ๋ณธ ์ •๋ณด</legend>
                <ul>
                    <li><label for="name">์ด๋ฆ„</label><input type="text" id="name"></li>
                    <li><label for="number">๋„๊ฐ ๋ฒˆํ˜ธ</label><input type="text" id="number"></li>
                </ul>
            </fieldset>
            <fieldset>
                <legend>ํฌ์ผ“๋ชฌ ์„ธ๋ถ€ ์ •๋ณด</legend>
                <ul>
                    <li><label for="category">๋ถ„๋ฅ˜</label><input type="text" id="category"></li>
                    <li><label for="height">์‹ ์žฅ</label><input type="text" id="height"></li>
                    <li><label for="weight">์ฒด์ค‘</label><input type="weight"></li>
                </ul>
            </fieldset>
        </form>
    </body>
    </html>

     

    2. ์‚ฌ์šฉ์ž๊ฐ€ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๋Š” <input> ํƒœ๊ทธ

    (1) <input> ํƒœ๊ทธ๋ž€?

    • ํผ์—์„œ ์‚ฌ์šฉ์ž ์ž…๋ ฅ์„ ๋ฐ›๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•˜๋Š” ํƒœ๊ทธ์ž…๋‹ˆ๋‹ค.

     

    (2) <input> ํƒœ๊ทธ - ์ž…๋ ฅ ํ•ญ๋ชฉ ๋งŒ๋“ค๊ธฐ

    • id ์†์„ฑ์€ ์—ฌ๋Ÿฌ๋ฒˆ ์‚ฌ์šฉ๋œ ํผ ์š”์†Œ๋ฅผ ๊ตฌ๋ถ„ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
      • ์˜ˆ) <input type="text" id="user-id" size="1">
      •       <input type="text" id="user-name" size="2">
    • type ์†์„ฑ์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์œ ํ˜• : hidden, text, search, tel, url ๋“ฑ
    • ๊ธฐ๋ณธํ˜• : <input type="์œ ํ˜•" [์†์„ฑ="์†์„ฑ ๊ฐ’"]>

     

    (3) type="hidden" - ํžˆ๋“  ํ•„๋“œ ๋งŒ๋“ค๊ธฐ

    • ํ™”๋ฉด์ƒ์˜ ํผ์—๋Š” ๋ณด์ด์ง€ ์•Š์ง€๋งŒ ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅ์„ ๋งˆ์น˜๊ณ  ํผ์„ ์„œ๋ฒ„๋กœ ์ „์†กํ•  ๋•Œ ์„œ๋ฒ„๋กœ ํ•จ๊ป˜ ์ „์†ก๋˜๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="hidden" name="์ด๋ฆ„" value="์„œ๋ฒ„๋กœ ๋„˜๊ธธ ๊ฐ’">

     

    (4) type="text" - ํ…์ŠคํŠธ ํ•„๋“œ ๋งŒ๋“ค๊ธฐ

    • ํ•œ ์ค„์งœ๋ฆฌ ์ผ๋ฐ˜ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜๋Š” ํ•„๋“œ์ž…๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="text" [์†์„ฑ="์†์„ฑ ๊ฐ’"]

     

    (5) type="password" - ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ๋ž€ ๋งŒ๋“ค๊ธฐ

    • ๋น„๋ฐ€๋ฒˆํ˜ธ ์ž…๋ ฅ๋ž€์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
    • ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•˜๋Š” ๋‚ด์šฉ์ด ํ™”๋ฉด์— ํ‘œ์‹œ๋˜์ง€ ์•Š๊ณ  '*'๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="password" [์†์„ฑ="์†์„ฑ ๊ฐ’"]>

     

    (1) ~ (5) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>์•„์ด๋””์™€ ํŒจ์Šค์›Œ๋“œ</title>
        <style>
    
        </style>
    </head>
    <body>
        <form>
            <fieldset>
                <label>์•„์ด๋”” : <input type="text" id="user-id" size="20"></label>
                <label>ํŒจ์Šค์›Œ๋“œ : <input type="password" id="user-pw" size="50"></label>
                <input type="submit" value="๋กœ๊ทธ์ธ">
            </fieldset>
        </form>
    </body>
    </html>

    ์›€์ง์ด๋Š” ์ด๋ฏธ์ง€์ž…๋‹ˆ๋‹ค

     

    (6) type="serch", type="url", type="email", type="tel" - ๋ถ„ํ™”๋œ ํ…์ŠคํŠธ ํ•„๋“œ

    • type="serch" ์‚ฌ์šฉ ์‹œ, ์ผ๋ถ€ ๋ธŒ๋ผ์šฐ์ €์—์„œ๋Š” ๊ฒ€์ƒ‰ ์ฐฝ์— ๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ–ˆ์„ ๋•Œ ์˜ค๋ฅธ์ชฝ์— x๊ฐ€ ํ‘œ์‹œ๋˜์–ด ์ž…๋ ฅํ•œ ๊ฒ€์ƒ‰์–ด๋ฅผ ์†์‰ฝ๊ฒŒ ์ง€์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • type="url" ์‚ฌ์šฉ ์‹œ, ์ด ํ•„๋“œ์—๋Š” ๋ฐ˜๋“œ์‹œ 'http://' ๋กœ ์‹œ์ž‘ํ•˜๋Š” ์‚ฌ์ดํŠธ ์ฃผ์†Œ๋ฅผ ์ž…๋ ฅํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    • type="email" ์‚ฌ์šฉ ์‹œ, ๋ธŒ๋ผ์šฐ์ € ์ž์ฒด์—์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ๋‚ด์šฉ์ด ๋ฉ”์ผ ์ฃผ์†Œ ํ˜•์‹(@)์— ๋งž๋Š”์ง€ ์ž๋™์œผ๋กœ ์ฒดํฌํ•ด์ค๋‹ˆ๋‹ค.
    • type="tel" ์‚ฌ์šฉ ์‹œ, ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ ์ •๋ณด๊ฐ€ ์ผ๋ฐ˜ ํ…์ŠคํŠธ๊ฐ€ ์•„๋‹ˆ๋ผ ์ „ํ™”๋ฒˆํ˜ธ๋ผ๋Š” ์‚ฌ์‹ค์„ ์ธ์‹ํ•ฉ๋‹ˆ๋‹ค.

     

    (6) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>ํšŒ์› ๊ฐ€์ž… ํŽ˜์ด์ง€ ๋งŒ๋“ค๊ธฐ</title>
        <style>
            ul{
                list-style: none;
            }
    
            li{
                margin: 15px;
            }
    
            li label{
                width: 120px;
                float: left;
                text-align: right;
                padding-right: 8px;
            }
    
            input[type="submit"] {
                text-align: center;
                width: 100%;
                height: 30px;
                margin-top: 20px;
            }
    
        </style>
    </head>
    <body>
        <h1>ํšŒ์› ๊ฐ€์ž…</h1>
        <form>
            <fieldset>
                <legend>๋กœ๊ทธ์ธ ์ •๋ณด ์ž…๋ ฅํ•˜๊ธฐ</legend>
                <ul>
                    <li><label for="user-id">์•„์ด๋””</label><input type="text" id="user-id"></li>
                    <li><label for="user-pw1">๋น„๋ฐ€๋ฒˆํ˜ธ</label><input type="password" id="user-pw1"></li>
                    <li><label for="user-pw2">๋น„๋ฐ€๋ฒˆํ˜ธ ํ™•์ธ</label><input type="password" id="user-pw2"></li>
                </ul>
            </fieldset>
            <fieldset>
                <legend>๊ฐœ์ธ ์ •๋ณด ์ž…๋ ฅํ•˜๊ธฐ</legend>
                <ul>
                    <li><label for="user-name">์ด๋ฆ„</label><input type="text" id="user-name"></li>
                    <li><label for="mail">๋ฉ”์ผ ์ฃผ์†Œ</label><input type="email" id="mail"></li>
                    <li><label for="phone">์—ฐ๋ฝ์ฒ˜</label><input type="tel" id="phone"></li>
                </ul>
            </fieldset>
            <input type="submit" value="๊ฐ€์ž…ํ•˜๊ธฐ">
        </form>
    </body>
    </html>

     

    (7) type="number" - ์ˆซ์ž ์ž…๋ ฅํ•˜๊ธฐ

    • ์ž…๋ ฅ ์ฐฝ์— ์ˆซ์ž๋ฅผ ์ง์ ‘ ์ž…๋ ฅํ•˜๋Š” ๊ฒƒ์ด ๊ธฐ๋ณธ์ด์ง€๋งŒ, ์ผ๋ถ€ ๋ธŒ๋ผ์šฐ์ €(ํŒŒ์ด์–ด ํญ์Šค)์—์„œ๋Š” ์Šคํ•€ ๋ฐ•์Šค๊ฐ€ ํ‘œ์‹œ๋˜์–ด ํ™”์‚ดํ‘œ๋ฅผ ํด๋ฆญํ•˜์—ฌ ์ˆซ์ž๋ฅผ ์ฆ๊ฐ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

     

    (8) type="range" - ์Šฌ๋ผ์ด๋“œ ๋ง‰๋Œ€๋กœ ์ˆซ์ž ์ง€์ •ํ•˜๊ธฐ

    • ์Šฌ๋ผ์ด๋“œ ๋ง‰๋Œ€๋ฅผ ์›€์ง์—ฌ ์ˆซ์ž ๊ฐ’์„ ์ž…๋ ฅํ•˜๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.
    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>make cake</title>
        <style>
            body {
                background-color: beige;
            }
    
            form legend{
                font-size: 20px;
                font-weight: 100;
            }
    
            form label.reg {
                font-size: 15px;
                float: left;
            }
    
            form ul li {
                list-style: none;
                margin: 15px 0;
            }
    
            #cake, #sugar, #flavor {
                margin-left: 5px;
                width: 50px;
            }
        </style>
    </head>
    <body>
        <form>
            <fieldset>
                <legend>์ผ€์ดํฌ ๋งŒ๋“ค๊ธฐ</legend>
                <ul>
                    <li>
                        <label class="reg" for="cake">๋งŒ๋“ค ์ผ€์ดํฌ ๊ฐฏ์ˆ˜<small>(์ตœ๋Œ€ 20๊ฐœ)</small></label>
                        <input type="number" id="cake" value="1" min="0" max="20" step="1">
                    </li>
                    <li>
                        <label class="reg" for="sugar">๋‹น๋„ ์„ค์ •<small>(0 ~ 100)</small></label>
                        <input type="number" id="sugar" value="0" min="0" max="100" step="20">
                    </li>
                    <li>
                        <label class="reg" for="flavor">๋ง› ์„ค์ •<small>(1 : ์ดˆ์ฝ” / 2 : ๋”ธ๊ธฐ / 3 : ๋ฐ”๋‹๋ผ)</small></label>
                        <input type="range" id="flavor" value="1" min="1" max="3">
                    </li>
                </ul>
            </fieldset>
        </form>
    </body>
    </html>

    ์›€์ง์ด๋Š” ์ด๋ฏธ์ง€์ž…๋‹ˆ๋‹ค

     

    (9) type="radio", type="checkbox" - ๋ผ๋””์˜ค ๋ฒ„ํŠผ๊ณผ ์ฒดํฌ๋ฐ•์Šค ๋„ฃ๊ธฐ

    • ์›ํ•˜๋Š” ํ•ญ๋ชฉ์„ ์„ ํƒํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํผ ์š”์†Œ์ž…๋‹ˆ๋‹ค.
    • ํ•œ ๊ฐœ๋งŒ ์„ ํƒํ•˜๋„๋ก ํ•  ๊ฒฝ์šฐ์—๋Š” ๋ผ๋””์˜ค ๋ฒ„ํŠผ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
    • ๋‘ ๊ฐœ ์ด์ƒ ์—ฌ๋Ÿฌ ๊ฐ€์ง€๋ฅผ ์„ ํƒํ•ด๋„ ๋  ๊ฒฝ์šฐ์—๋Š” ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="radio" [์†์„ฑ="์†์„ฑ ๊ฐ’"]>
    •              <input type="checkbox" [์†์„ฑ="์†์„ฑ ๊ฐ’"]>

     

    (9) ์˜ˆ์ œ 

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>radio ํ•˜๋ฉด radio gaga</title>
        <style>
            body {
                background-color: rgb(164, 200, 223);
            }
            form fieldset{
                margin-bottom: 30px;
            }
            form legend{
                font-size: 20px;
                font-weight: 700;
            }
            form label.r{
                font-size: 17px;
                color: white;
                font-weight: bold;
                width: 110px;
                text-align: right;
                margin-right: 10px;
            }
            form ul li {
                list-style: none;
                margin: 20px;
                font-size: 15px;
            }
        </style>
    </head>
    <body>
        <form>
            <fieldset>
                <legend>ํ€ธ</legend>
                <p>ํ€ธ์˜ ์ตœ์•  ๋ฉค๋ฒ„๋ฅผ ์„ ํƒํ•ด์ฃผ์„ธ์š” (1๋ช…)</p>
                <label class="r"><input type="radio" name="queen" value="drum">๋กœ์ € ํ…Œ์ผ๋Ÿฌ</label>
                <label class="r"><input type="radio" name="queen" value="guitar">๋ธŒ๋ผ์ด์–ธ ๋ฉ”์ด</label>
                <label class="r"><input type="radio" name="queen" value="sing and piano">ํ”„๋ ˆ๋”” ๋จธํ๋ฆฌ</label>
                <label class="r"><input type="radio" name="queen" value="base">์กด ๋””์ฝ˜</label>
            </fieldset>
            <fieldset>
                <legend>๋…ธ๋ž˜</legend>
                <p>ํ€ธ์˜ ๋ช…๊ณก์€ ๋ฐ”๋กœ... (๋ณต์ˆ˜ ์„ ํƒ ๊ฐ€๋Šฅ!)</p>
                <label><input type="checkbox" name="music1" value="bo">Bohemian Rhapsody</label>
                <label><input type="checkbox" name="music2" value="ra">Radio Ga Ga</label>
                <label><input type="checkbox" name="music3" value="we">We Will Rock You</label>
                <label><input type="checkbox" name="music4" value="do">Don't Stop Me Now</label>
            </fieldset>
        </form>
    </body>
    </html>

     

    (10) type="color" – ์ƒ‰์ƒ ์„ ํƒ ์ƒ์ž ํ‘œ์‹œํ•˜๊ธฐ

    • ์ƒ‰์ƒํ‘œ์—์„œ ์‚ฌ์šฉ์ž๊ฐ€ ์ƒ‰์ƒ์„ ์„ ํƒํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค€๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="color" value="๊ธฐ๋ณธ ์ƒ‰">

     

    (10) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>์ƒ‰์ƒ ์„ ํƒํ•˜๊ธฐ</title>
    </head>
    <body>
        <form>
            <fieldset>
                <legend>ํ‹ฐ์…”์ธ  ๋งŒ๋“ค๊ธฐ</legend>
                <p>์•ˆ๋…•ํ•˜์„ธ์š”. ์งฑ๊ตฌ ํ‹ฐ์…”์ธ ๋ฅผ ๋งŒ๋“ค๊ณ  ์‹ถ์€๋ฐ, ์ƒ‰์ƒ ์ถ”์ฒœ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.</p>
                <label>์ƒ‰์ƒ <input type="color" value="black"></label>
            </fieldset>
        </form>
    </body>
    </html>

     

    (11) type="date", type="month", type="week" – ๋‚ ์งœ ํ‘œ์‹œํ•˜๊ธฐ

    • type="date"๋กœ ์ง€์ •ํ•˜๋ฉด ๋‹ฌ๋ ฅ์—์„œ ๋‚ ์งœ๋ฅผ ์„ ํƒํ–ˆ์„ ๋•Œ ํ•„๋“œ์— "yyyy-mm-dd" ํ˜•์‹์œผ๋กœ ์—ฐ๋„์™€ ์›”, ์ผ์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

     

    (11) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>๋‚ ์งœ</title>
    </head>
    <body>
        <form>
            <h1>๊ธฐ๊ฐ„ ์„ ํƒํ•˜๊ธฐ</h1>
            <label>
                <input type="date" id="start">
            </label>
            <label>
                <input type="date" id="end">
            </label>
        </form>
    </body>
    </html>

     

    (12) type="time", type="datetime", type="datetime-local" – ์‹œ๊ฐ„ ์ง€์ •ํ•˜๊ธฐ

    • ์‹œ๊ฐ„๋„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

     

    (12) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>์‹œ๊ฐ„ ์„ค์ •</title>
    </head>
    <body>
        <form>
            <h3>๋Œ€์—ฌ ์‹œ๊ฐ„์„ ์„ ํƒํ•˜์„ธ์š”</h3>
            <p>์„ ํƒ ๋Œ€์—ฌ ์ œํ’ˆ - ๋‹Œํ…๋„ ์Šค์œ„์น˜</p>
            <label>์‹œ์ž‘ ์‹œ๊ฐ„ <input type="time" value="10:00" id="start"></label>
            <label>์ข…๋ฃŒ ์‹œ๊ฐ„ <input type="time" value="18:00" id="end"></label>
    
            <h3>๋Œ€์—ฌ ์‹œ๊ฐ„์„ ์„ ํƒํ•˜์„ธ์š”</h3>
            <p>์„ ํƒ ๋Œ€์—ฌ ์ œํ’ˆ - ํ”Œ์Šค 5</p>
            <label>์‹œ์ž‘ ์‹œ๊ฐ„ <input type="datetime-local" value="2022-05-01T10:00" id="start"></label>
            <label>์ข…๋ฃŒ ์‹œ๊ฐ„ <input type="datetime-local" value="2022-05-01T18:00" id="end"></label>
        </form>
    </body>
    </html>

     

    (13) type="submit", type="reset" – ์„œ๋ฒ„ ์ „์†ก, ๋ฆฌ์…‹ ๋ฒ„ํŠผ ๋„ฃ๊ธฐ

    • type="reset"์€ <input> ์š”์†Œ์— ์ž…๋ ฅ๋œ ๋ชจ๋“  ์ •๋ณด๋ฅผ ์ง€์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • type="submit"์€ ์‚ฌ์šฉ์ž๊ฐ€ ํผ์— ์ž…๋ ฅํ•œ ์ •๋ณด๋ฅผ ์„œ๋ฒ„๋กœ ์ „์†กํ•˜๋Š” submit ๋ฒ„ํŠผ์„ ๋„ฃ๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.

     

    (13) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>submit & reset</title>
    </head>
    <body>
        <h3>์ „์†ก๊ณผ ๋ฆฌ์…‹</h3>
        <form action="info.php" method="post">
            <label>์ด๋ฆ„ ์ž…๋ ฅ <input type="text"></label>
            <input type="submit" value="์ „์†ก">
            <input type="reset" value="๋‹ค์‹œ์ž…๋ ฅ">
        </form>
    </body>
    </html>

     

    (14) type="image" – ์ด๋ฏธ์ง€ ๋ฒ„ํŠผ ๋„ฃ๊ธฐ

    • submit ๋ฒ„ํŠผ ๋Œ€์‹  ์ „์†ก ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜•: <input type="image" src="๊ฒฝ๋กœ" alt="๋Œ€์ฒด ํ…์ŠคํŠธ">

     

    (14) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>์ด๋ฏธ์ง€ ๋ฒ„ํŠผ</title>
    </head>
    <body>
        <form>
            <label>์•„์ด๋”” <input type="text"></label>
            <label>๋น„๋ฐ€๋ฒˆํ˜ธ <input type="password"></label>
            <input type="image" id="button" src="images/login.jpg" alt="login">
        </form>
    </body>
    </html>

    (15) type="button" – ๋ฒ„ํŠผ ๋„ฃ๊ธฐ

    • ํผ ์•ˆ์— ๋ฒ„ํŠผ ํ˜•ํƒœ๋ฅผ ๋งŒ๋“œ๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.
    • ์ด ๋ฒ„ํŠผ์€ submit์ด๋‚˜ reset ๊ฐ™์€ ์ž์ฒด ๊ธฐ๋Šฅ์ด ์—†๊ณ  ์˜ค์ง ๋ฒ„ํŠผ ํ˜•ํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ์Šคํฌ๋ฆฝํŠธ ํ•จ์ˆ˜ ๋“ฑ์„ ์—ฐ๊ฒฐํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

     

    (15) ์˜ˆ์ œ

    <!DOCTYPE html>
    <html lang="ko">
    <head>
        <meta charset="UTF-8">
        <title>๋ฒ„ํŠผ ๋งŒ๋“ค๊ธฐ</title>
    </head>
    <body>
        <form>
            <input type="button" value="์ƒˆ ํƒญ ์—ด๊ธฐ" onclick="window.open()">
        </form>
    </body>
    </html>

     

    (16) type="file" – ํŒŒ์ผ ์ฒจ๋ถ€ํ•˜๊ธฐ

    • ์›น ๋ธŒ๋ผ์šฐ์ € ํ™”๋ฉด์— [ํŒŒ์ผ ์„ ํƒ]์ด๋‚˜ [์ฐพ์•„๋ณด๊ธฐ] ๋“ฑ์ด ํ‘œ์‹œ๋˜๋Š”๋ฐ, ์ด ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ํŒŒ์ผ์„ ์„ ํƒํ•˜๋ฉด ํŒŒ์ผ์ด ์ฒจ๋ถ€๋ฉ๋‹ˆ๋‹ค.
    • ๊ธฐ๋ณธํ˜• : <input type="file" [์†์„ฑ="์†์„ฑ ๊ฐ’"]

     

     

    ๋งˆ๋ฌด๋ฆฌํ•˜๋ฉฐ

    ํผ ๊ด€๋ จ ํƒœ๊ทธ 1ํƒ„์„ ๊ณต๋ถ€ํ•ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

    2ํƒ„์—์„œ๋„ ํผ๊ณผ ๊ด€๋ จ๋œ ๋” ๋‹ค์–‘ํ•œ ํƒœ๊ทธ๋“ค์„ ๊ณต๋ถ€ํ•ด๋ณด๋Š” ์‹œ๊ฐ„์„ ๊ฐ€์ ธ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

     

    ๋Œ“๊ธ€๊ณผ ๊ณต๊ฐ์€ ํ•ญ์ƒ ํ™˜์˜์ž…๋‹ˆ๋‹ค!

    ๋Œ“๊ธ€