์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ - form

2020. 9. 17. 00:02ใ†์ „๊ณต ๊ณผ๋ชฉ/์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ

์›น ํ”„๋กœ๊ทธ๋ž˜๋ฐ - form

 

์˜ค๋Š˜์€ form์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์ž.

form์ด๋ž€ ๋ฌด์—‡์ผ๊นŒ?

form์€ ์›น ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค ๋•Œ ํšŒ์›๊ฐ€์ž…์ด๋‚˜ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ •๋ณด๋ฅผ ์ž…๋ ฅ๋ฐ›๋Š” ํŽ˜์ด์ง€๋ฅผ ๋งŒ๋“ค๋•Œ ํ•„์ˆ˜์ ์œผ๋กœ ์“ฐ์ด๋Š” ๋งค์šฐ ์ค‘์š”ํ•œ ํƒœ๊ทธ์ด๋‹ค. 

 

๋ฐ”๋กœ ์‹ค์ „์œผ๋กœ ๋„˜์–ด๊ฐ€๋ณด์ž.

 

ํ…์ŠคํŠธ์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "text"

๋น„๋ฐ€๋ฒˆํ˜ธ์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "password"

์ฒดํฌ๋ฐ•์Šค์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "checkbox"

radio์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "radio"

select์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "select"

textarea์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "textarea"

์ œ์ถœ์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "submit"

์ทจ์†Œ์— ๋Œ€ํ•œ ํƒœ๊ทธ : input type = "reset"

 

๊ฐœ๋…์€ ์ด๋ ‡๋‹ค. ์•„๋ž˜์™€ ๊ฐ™์€ ํ™”๋ฉด์„ ์ฝ”๋“œ๋กœ ์ž‘์„ฑํ•ด๋ณด์ž.

 

์†Œ์Šค ์ฝ”๋“œ

<!DOCTYPE html>
<html>
<head>
</head>
<body>
 <form method = "get" name = "form1" action = "">
์ด๋ฆ„:<input type = "text" id = "name" value = "๋‹น์‹ ์˜ ์ด๋ฆ„์€?"><br>
๋น„๋ฐ€๋ฒˆํ˜ธ: <input type = "password" id = "pwd"><br>
์ข‹์•„ํ•˜๋Š” ๊ณผ๋ชฉ ์„ ํƒ <input type = "checkbox" id = "subject">๊ตญ์–ด
                  <input type = "checkbox" id = "subject">์˜์–ด
                  <input type = "checkbox" id = "subject">์ˆ˜ํ•™
                  <input type = "checkbox" id = "subject">์—ญ์‚ฌ
                  <input type = "checkbox" id = "subject">์ง€๋ฆฌ<br>
 <input type = "radio" id = "subject2">Korean
 <input type = "radio" id = "subject2">English
 <input type = "radio" id = "subject2">Math
 <input type = "radio" id = "subject2">History
 <input type = "radio" id = "subject2">Geographic<br>
 <select name = "city" size ="5" multiple>
 <option>์„œ์šธ</option>
 <option checked>๋ถ€์‚ฐ</option>
 <option checked>๋Œ€๊ตฌ</option>
 <option>์ œ์ฃผ</option>
 <option>๊ด‘์ฃผ</option>
 </select>

์ž๊ธฐ์†Œ๊ฐœ์„œ<br>
<textarea name = "city" cols = "20" rows = "10">
</textarea><br>

<input type = "submit" value = "์ œ์ถœ"><input type  = "reset" value = "์ทจ์†Œ">
 </form>
</body>
</html>

 

textarea์™€ select๋Š” input type์œผ๋กœ ์ฃผ์ง€์•Š๊ณ  ๋ฐ”๋กœ ํƒœ๊ทธ๋ฅผ ์ฃผ๋ฉด ๋œ๋‹ค.

๊ทธ๋ฆฌ๊ณ  select์—์„œ ๋‹ค์ค‘์œผ๋กœ ์„ ํƒํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” multiple์„ ์ฃผ์–ด์•ผ ํ•œ๋‹ค.