Search

μž…λ ₯양식 νƒœκ·Έ

μž…λ ₯양식 νƒœκ·Έ

μ›Ή νŽ˜μ΄μ§€μ—μ„œ μ‚¬μš©μžλ‘œλΆ€ν„° 데이터λ₯Ό μž…λ ₯λ°›κΈ° μœ„ν•΄ μ‚¬μš©ν•˜λŠ” HTML νƒœκ·Έ
νƒœκ·Έ
μ„€λͺ…
μ£Όμš” 속성
<form>
데이터λ₯Ό μ„œλ²„λ‘œ μ „μ†‘ν•˜κΈ° μœ„ν•œ μ˜μ—­μ„ μ •μ˜ν•˜λŠ” νƒœκ·Έ
action, method
<input>
ν…μŠ€νŠΈ μž…λ ₯, μ²΄ν¬λ°•μŠ€, λΌλ””μ˜€ λ²„νŠΌ λ“± λ‹€μ–‘ν•œ μž…λ ₯을 받을 수 μžˆλŠ” νƒœκ·Έ
type, name, value, placeholder
<select>
λ“œλ‘­λ‹€μš΄ λͺ©λ‘μ„ μ œκ³΅ν•˜μ—¬ μ‚¬μš©μžκ°€ μ˜΅μ…˜μ„ 선택할 수 μžˆλ„λ‘ ν•˜λŠ” νƒœκ·Έ
name, multiple, size
<textarea>
μ—¬λŸ¬ μ€„μ˜ ν…μŠ€νŠΈ μž…λ ₯을 받을 수 μžˆλŠ” νƒœκ·Έ
name, rows, cols, placeholder
β€’
form
β—¦
input
β—¦
select
β—¦
textarea
β€’
κΈ°λ³Έμž…λ ₯
β€’
μž…λ ₯νƒ€μž…
β€’
μ„ νƒμž…λ ₯
β€’
μž₯λ¬Έμž…λ ₯
β€’
μž…λ ₯μ˜΅μ…˜

form νƒœκ·Έ

ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ μ„œλ²„λ‘œ 데이터λ₯Ό μ œμΆœν•΄μ£ΌλŠ” 양식 νƒœκ·Έ
속성
μ„€λͺ…
action
데이터λ₯Ό λ°›μ•„μ„œ μ²˜λ¦¬ν•  URL 경둜 지정
method
데이터λ₯Ό λ³΄λ‚΄λŠ” 방식을 지정 (GET, POST)

HTTP λ©”μ†Œλ“œ

ν΄λΌμ΄μ–ΈνŠΈ(μ‚¬μš©μž)κ°€ μ„œλ²„μ—κ²Œ μ–΄λ–€ μž‘μ—…μ„ μš”μ²­ν•  λ•Œ μ‚¬μš©ν•˜λŠ” 방식
λ©”μ†Œλ“œ
μ„€λͺ…
νŠΉμ§•
GET
μ„œλ²„μ—μ„œ 데이터λ₯Ό μ‘°νšŒν•  λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- URL에 μš”μ²­ 데이터λ₯Ό 포함 - 데이터 λ…ΈμΆœ - μ„œλ²„ μƒνƒœλ₯Ό λ³€κ²½ν•˜μ§€ μ•ŠμŒ - μΊμ‹œ κ°€λŠ₯
POST
μ„œλ²„μ— 데이터λ₯Ό μ „μ†‘ν•˜μ—¬ λ¦¬μ†ŒμŠ€λ₯Ό μƒμ„±ν•˜κ±°λ‚˜ μ—…λ°μ΄νŠΈν•  λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- 데이터가 본문에 포함 - λ³΄μ•ˆμ„±μ΄ λ†’μŒ (URL에 데이터가 λ…ΈμΆœλ˜μ§€ μ•ŠμŒ) - 데이터 생성
PUT
μ„œλ²„μ— κΈ°μ‘΄ λ¦¬μ†ŒμŠ€λ₯Ό 전체 μˆ˜μ •ν•˜κ±°λ‚˜ ꡐ체할 λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- 전체 λ¦¬μ†ŒμŠ€λ₯Ό μ—…λ°μ΄νŠΈ - 데이터가 본문에 포함
PATCH
μ„œλ²„μ—μ„œ κΈ°μ‘΄ λ¦¬μ†ŒμŠ€μ˜ 일뢀λ₯Ό μˆ˜μ •ν•  λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- 일뢀 λ°μ΄ν„°λ§Œ μ—…λ°μ΄νŠΈ - 데이터가 본문에 포함
DELETE
μ„œλ²„μ—μ„œ λ¦¬μ†ŒμŠ€λ₯Ό μ‚­μ œν•  λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- 데이터 μ‚­μ œ μš”μ²­
OPTIONS
μ„œλ²„κ°€ μ§€μ›ν•˜λŠ” HTTP λ©”μ†Œλ“œ λͺ©λ‘μ„ 확인할 λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- μ„œλ²„μ—μ„œ μ‚¬μš©ν•  수 μžˆλŠ” λ©”μ†Œλ“œ λͺ©λ‘μ„ λ°˜ν™˜
HEAD
GET μš”μ²­κ³Ό μœ μ‚¬ν•˜μ§€λ§Œ, 응닡 λ³Έλ¬Έ 없이 헀더 μ •λ³΄λ§Œ μš”μ²­ν•  λ•Œ μ‚¬μš©ν•˜λŠ” λ©”μ†Œλ“œ
- 응닡 본문을 μ œμ™Έν•œ ν—€λ”λ§Œ λ°˜ν™˜ - λ¦¬μ†ŒμŠ€μ˜ 메타데이터λ₯Ό 확인할 λ•Œ μ‚¬μš©
form νƒœκ·Έμ—μ„œ μ§€μ›ν•˜λŠ” μš”μ²­ 방식은 GETκ³Ό POST 두 κ°€μ§€μž…λ‹ˆλ‹€.
방식
μ„€λͺ…
GET
URL μ£Όμ†Œ 뒀에 νŒŒλΌλ―Έν„°(쿼리슀트링)λ₯Ό λΆ™μ—¬ μ „λ‹¬ν•˜λŠ” 방식 예: input.jsp?input1=100&input2=200 (쿼리슀트링)
POST
URL μ£Όμ†Œμ— νŒŒλΌλ―Έν„°λ₯Ό 뢙이지 μ•Šκ³  HTTP Request 헀더에 데이터λ₯Ό ν¬ν•¨μ‹œμΌœ μ „μ†‘ν•˜λŠ” 방식
GET vs. POST
GET
POST
κΈ€μž 수 μ œν•œ
μ΅œλŒ€ 2048 κΈ€μž
μ œν•œ μ—†μŒ
데이터 λ…ΈμΆœ
데이터가 URL에 λ…ΈμΆœλ¨
데이터가 HTTP 헀더에 ν¬ν•¨λ˜μ–΄ 전솑됨
뢁마크 κ°€λŠ₯
κ°€λŠ₯
λΆˆκ°€λŠ₯
λ’€λ‘œκ°€κΈ° κ°€λŠ₯
κ°€λŠ₯
λΆˆκ°€λŠ₯

GET 방식 HTTP μš”μ²­ λ©”μ‹œμ§€ μ˜ˆμ‹œ

GET /posts?page=1&keyword=HTML HTTP/1.1 Host: μ•Œν΄.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9
Plain Text
볡사

POST 방식 HTTP μš”μ²­ λ©”μ‹œμ§€ μ˜ˆμ‹œ

POST /auto/login HTTP/1.1 Host: μ•Œν΄.com Content-Type: application/x-www-form-urlencoded Content-Length: 35 username=user123&password=pass123
Plain Text
볡사

<input> νƒœκ·Έ

속성
μ„€λͺ…
type
μž…λ ₯ ν•„λ“œμ˜ μœ ν˜•μ„ 지정 (text, password, checkbox, radio, file λ“±)
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
value
μž…λ ₯ ν•„λ“œμ— 미리 μž…λ ₯될 값을 지정
placeholder
μ‚¬μš©μžκ°€ μž…λ ₯ν•˜κΈ° μ „κΉŒμ§€ ν‘œμ‹œλ˜λŠ” 힌트 ν…μŠ€νŠΈ
required
μž…λ ₯ ν•„λ“œλ₯Ό ν•„μˆ˜ ν•­λͺ©μœΌλ‘œ μ„€μ •
disabled
μž…λ ₯ ν•„λ“œλ₯Ό λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ μž…λ ₯ν•  수 μ—†κ²Œ μ„€μ •
readonly
μž…λ ₯ ν•„λ“œλ₯Ό 읽기 μ „μš©μœΌλ‘œ μ„€μ •ν•˜μ—¬ μˆ˜μ •ν•  수 μ—†κ²Œ μ„€μ •

<select> νƒœκ·Έ

속성
μ„€λͺ…
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
multiple
μ—¬λŸ¬ 개의 μ˜΅μ…˜μ„ 선택할 수 μžˆλ„λ‘ μ„€μ •
size
λ³΄μ—¬μ§ˆ μ˜΅μ…˜ λͺ©λ‘μ˜ 개수λ₯Ό 지정
disabled
λ“œλ‘­λ‹€μš΄ 메뉴λ₯Ό λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ 선택할 수 μ—†κ²Œ μ„€μ •

<textarea> νƒœκ·Έ

속성
μ„€λͺ…
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
rows
ν…μŠ€νŠΈ μ˜μ—­μ˜ μ„Έλ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (쀄 수)
cols
ν…μŠ€νŠΈ μ˜μ—­μ˜ κ°€λ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (μ—΄ 수)
placeholder
μ‚¬μš©μžκ°€ μž…λ ₯ν•˜κΈ° μ „κΉŒμ§€ ν‘œμ‹œλ˜λŠ” 힌트 ν…μŠ€νŠΈ
required
μž…λ ₯ ν•„λ“œλ₯Ό ν•„μˆ˜ ν•­λͺ©μœΌλ‘œ μ„€μ •
disabled
ν…μŠ€νŠΈ μ˜μ—­μ„ λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ μž…λ ₯ν•  수 μ—†κ²Œ μ„€μ •

κΈ°λ³Έμž…λ ₯

μž…λ ₯ 양식 νƒœκ·Έλ‘œ κ°„λ‹¨ν•œ κΈ°λ³Έ μž…λ ₯을 ν•˜λŠ” 방법을 μ•Œμ•„λ΄…λ‹ˆλ‹€.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>μž…λ ₯양식 - κΈ°λ³Έ μž…λ ₯</title> </head> <body> <h1>μž…λ ₯ 양식 νƒœκ·Έ - form</h1> <h2>둜그인</h2> <form action="http://μ•Œν΄.com/auth/login" method="post"> <input type="hidden" name="_csrf" value="chvm3SZ_pK5SETAJ-txjPa9rAb1h0MSmZnuyUXceOspQTDS4FCjXvB4ck8x_JwZrn_FXX81dLIVY5_KLBx-FZxInXPs1fACI"> <label for="id" >아이디</label> <input type="text" name="username" id="id" placeholder="아이디λ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”."> <br> <label for="pw" >λΉ„λ°€λ²ˆν˜Έ</label> <input type="password" name="password" id="pw" placeholder="λΉ„λ°€λ²ˆν˜Έλ₯Ό μž…λ ₯ν•΄μ£Όμ„Έμš”."> <br> <!-- form νƒœκ·Έ 내뢀에 type="submit" input νƒœκ·Έλ₯Ό μž‘μ„±ν•˜λ©΄ 전솑 λ²„νŠΌ --> <input type="submit" value="둜그인"> </form> <hr> </body> </html>
HTML
볡사

μž…λ ₯νƒ€μž…

input νƒœκ·Έμ˜ λ‹€μ–‘ν•œ type 을 μ•Œμ•„λ΄…λ‹ˆλ‹€.
type
μ„€λͺ…
μ˜ˆμ‹œ
text
ν•œ μ€„μ˜ ν…μŠ€νŠΈλ₯Ό μž…λ ₯λ°›λŠ” ν•„λ“œ
username μž…λ ₯ ν•„λ“œ
password
λΉ„λ°€λ²ˆν˜Έ μž…λ ₯ ν•„λ“œ (μž…λ ₯ν•œ λ¬Έμžκ°€ 화면에 ν‘œμ‹œλ˜μ§€ μ•ŠμŒ)
password μž…λ ₯ ν•„λ“œ
email
이메일 μ£Όμ†Œλ₯Ό μž…λ ₯λ°›λŠ” ν•„λ“œ
example@example.com μž…λ ₯ ν•„λ“œ
number
숫자 μž…λ ₯ ν•„λ“œ
age μž…λ ₯ ν•„λ“œ
tel
μ „ν™”λ²ˆν˜Έ μž…λ ₯ ν•„λ“œ
phone μž…λ ₯ ν•„λ“œ
url
URL을 μž…λ ₯λ°›λŠ” ν•„λ“œ
http://example.com μž…λ ₯ ν•„λ“œ
date
λ‚ μ§œλ₯Ό 선택할 수 μžˆλŠ” ν•„λ“œ
birthdate μž…λ ₯ ν•„λ“œ
time
μ‹œκ°„μ„ 선택할 수 μžˆλŠ” ν•„λ“œ
appointment μž…λ ₯ ν•„λ“œ
range
μŠ¬λΌμ΄λ” ν˜•νƒœμ˜ 숫자 μž…λ ₯ ν•„λ“œ
volume 쑰절 ν•„λ“œ
checkbox
μ²΄ν¬λ°•μŠ€ ν˜•νƒœμ˜ μž…λ ₯ ν•„λ“œ
subscribe 선택 ν•„λ“œ
radio
λΌλ””μ˜€ λ²„νŠΌ ν˜•νƒœμ˜ μž…λ ₯ ν•„λ“œ
gender 선택 ν•„λ“œ
file
νŒŒμΌμ„ μ—…λ‘œλ“œν•  수 μžˆλŠ” ν•„λ“œ
resume μ—…λ‘œλ“œ ν•„λ“œ
submit
폼을 μ œμΆœν•˜λŠ” λ²„νŠΌ
submit λ²„νŠΌ
reset
폼의 λ‚΄μš©μ„ μ΄ˆκΈ°ν™”ν•˜λŠ” λ²„νŠΌ
reset λ²„νŠΌ
button
일반 λ²„νŠΌ
custom λ²„νŠΌ
hidden
μ‚¬μš©μžμ—κ²Œ 보이지 μ•ŠλŠ” μˆ¨κ²¨μ§„ μž…λ ₯ ν•„λ“œ
user_id μž…λ ₯ ν•„λ“œ
search
검색을 μœ„ν•œ μž…λ ₯ ν•„λ“œ
search μž…λ ₯ ν•„λ“œ
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>μž…λ ₯ νƒ€μž…</title> </head> <body> <h1>μž…λ ₯ νƒ€μž…</h1> <form action="input" method="post"> ID : <input type="text" name="id"> <br> PW : <input type="password" name="password"> <br> email : <input type="email" name="email"> <br> url : <input type="url" name="url"> <br> tel : <input type="tel" name="tel"> <br> <hr> number : <input type="number" name="number"> <br> color : <input type="color" name="color"> <br> date : <input type="date" name="date"> <br> time : <input type="time" name="time"> <br> range : <input type="range" name="range"> <br> <hr> file : <input type="file" name="file"> <br> <hr> <input type="button" value="κΈ°λ³Έλ²„νŠΌ"> <input type="reset" value="μ·¨μ†Œν•˜κΈ°"> <input type="submit" value="μ œμΆœλ²„νŠΌ"> </form> </body> </html>
HTML
볡사

μ„ νƒμž…λ ₯

μ˜΅μ…˜μ„ 선택할 수 μžˆλŠ” μž…λ ₯ νƒœκ·Έμ— λŒ€ν•˜μ—¬ μ•Œμ•„λ΄…λ‹ˆλ‹€.
νƒœκ·Έ
type
μ„€λͺ…
μ‚¬μš© μ˜ˆμ‹œ
<input>
radio
λΌλ””μ˜€ λ²„νŠΌμ€ μ—¬λŸ¬ μ˜΅μ…˜ 쀑 ν•˜λ‚˜λ§Œ 선택할 수 μžˆλŠ” μž…λ ₯ ν•„λ“œ
성별 선택 (예: 남성, μ—¬μ„±)
<input>
checkbox
μ²΄ν¬λ°•μŠ€λŠ” μ—¬λŸ¬ μ˜΅μ…˜ 쀑 μ—¬λŸ¬ 개λ₯Ό 선택할 수 μžˆλŠ” μž…λ ₯ ν•„λ“œ
관심사 선택 (예: λ‰΄μŠ€λ ˆν„°, ν”„λ‘œλͺ¨μ…˜)
<select>
λ“œλ‘­λ‹€μš΄ λͺ©λ‘μ„ μ œκ³΅ν•˜μ—¬ μ‚¬μš©μžκ°€ ν•œ 가지 μ˜΅μ…˜μ„ 선택할 수 μžˆλŠ” μž…λ ₯ ν•„λ“œ
κ΅­κ°€ 선택 (예: λ―Έκ΅­, ν•œκ΅­, 일본)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>선택 μž…λ ₯</title> </head> <body> <h1>선택 μž…λ ₯</h1> <h2>λΌλ””μ˜€/μ²΄ν¬λ°•μŠ€</h2> <h3>radio - 성별</h3> <label for="female">μ—¬μž</label> <input type="radio" name="gender" id="female" value="female"> <label for="male">λ‚¨μž</label> <input type="radio" name="gender" id="male" value="male"> <br> <h3>checkbox - μ·¨λ―Έ</h3> <label for="exercise">μš΄λ™</label> <input type="checkbox" name="hobby" id="exercise" value="exercise"> <label for="music">μŒμ•…</label> <input type="checkbox" name="hobby" id="music" value="music"> <label for="movie">μ˜ν™”</label> <input type="checkbox" name="hobby" id="movie" value="movie"> <br> <h3>select - μ΄λ©”μΌμž…λ ₯</h3> <label for="email">이메일</label> <br> <input type="text" name="emailId" id="email"> @ <select name="domain" id="domain"> <option value="1">naver.com</option> <option value="2">gmail.com</option> <option value="3">kakao.com</option> <option value="4">nate.com</option> </select> <div style="height: 500px;"></div> </body> </html>
HTML
볡사

μž₯λ¬Έμž…λ ₯

μ—¬λŸ¬ μ€„μ˜ ν…μŠ€νŠΈλ₯Ό μž…λ ₯받을 수 μžˆλŠ” ν•„λ“œμ— λŒ€ν•˜μ—¬ μ•Œμ•„λ΄…λ‹ˆλ‹€.

<textarea> μ£Όμš” 속성

속성
μ„€λͺ…
μ˜ˆμ‹œ
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
<textarea name="comments">
rows
ν…μŠ€νŠΈ μ˜μ—­μ˜ μ„Έλ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (쀄 수)
<textarea rows="5">
cols
ν…μŠ€νŠΈ μ˜μ—­μ˜ κ°€λ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (μ—΄ 수)
<textarea cols="30">
placeholder
μ‚¬μš©μžκ°€ μž…λ ₯ν•˜κΈ° μ „κΉŒμ§€ ν‘œμ‹œλ˜λŠ” 힌트 ν…μŠ€νŠΈ
<textarea placeholder="Enter your comments here">
required
μž…λ ₯ ν•„λ“œλ₯Ό ν•„μˆ˜ ν•­λͺ©μœΌλ‘œ μ„€μ •
<textarea required></textarea>
disabled
ν…μŠ€νŠΈ μ˜μ—­μ„ λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ μž…λ ₯ν•  수 μ—†κ²Œ μ„€μ •
<textarea disabled></textarea>
readonly
μž…λ ₯ ν•„λ“œλ₯Ό 읽기 μ „μš©μœΌλ‘œ μ„€μ •ν•˜μ—¬ μˆ˜μ •ν•  수 μ—†κ²Œ μ„€μ •
<textarea readonly></textarea>
wrap
ν…μŠ€νŠΈ 쀄 λ°”κΏˆ 방법을 지정 (soft, hard)
<textarea wrap="soft">
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>κ²Œμ‹œκΈ€ μ“°κΈ°</title> </head> <body> <h1>κ²Œμ‹œκΈ€ μ“°κΈ°</h1> <table border="1"> <tr> <td>제λͺ©</td> <td> <input type="text" name="title" placeholder="제λͺ©μ„ μž…λ ₯ν•˜μ„Έμš”"> </td> </tr> <tr> <td>μž‘μ„±μž</td> <td> <input type="text" name="writer" placeholder="제λͺ©μ„ μž…λ ₯ν•˜μ„Έμš”"> </td> </tr> <tr> <td colspan="2"> <textarea name="content" placeholder="λ‚΄μš©μ„ μž…λ ₯ν•˜μ„Έμš”" rows="5" cols="40" maxlength="200" style="resize: none;"></textarea> <!-- rows : ν…μŠ€νŠΈ 쀄 수 --> <!-- cols : ν…μŠ€νŠΈ μ—΄(λ„ˆλΉ„). 문자 κΈ°μ€€ --> <!-- maxlength : μ΅œλŒ€ 문자 수 --> </td> </tr> <tr> <td colspan="2"> <button type="submit" style="width: 100%;">λ“±λ‘ν•˜κΈ°</button> </td> </tr> </table> </body> </html>
HTML
볡사

μž…λ ₯μ˜΅μ…˜

μž…λ ₯ 양식 νƒœκ·Έλ“€μ˜ μ˜΅μ…˜ 속성듀을 μ•Œμ•„λ΄…λ‹ˆλ‹€.
νƒœκ·Έ
속성
μ„€λͺ…
μ˜ˆμ‹œ
<input>
type
μž…λ ₯ ν•„λ“œμ˜ μœ ν˜•μ„ μ •μ˜ (text, password, email λ“±)
<input type="text">
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
<input name="username">
value
μž…λ ₯ ν•„λ“œμ˜ 초기 값을 μ„€μ •
<input value="default">
placeholder
μ‚¬μš©μžκ°€ μž…λ ₯ν•˜κΈ° μ „κΉŒμ§€ ν‘œμ‹œλ˜λŠ” 힌트 ν…μŠ€νŠΈ
<input placeholder="Enter your name">
required
μž…λ ₯ ν•„λ“œλ₯Ό ν•„μˆ˜ ν•­λͺ©μœΌλ‘œ μ„€μ •
<input required>
disabled
μž…λ ₯ ν•„λ“œλ₯Ό λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ μž…λ ₯ν•  수 μ—†κ²Œ μ„€μ •
<input disabled>
readonly
μž…λ ₯ ν•„λ“œλ₯Ό 읽기 μ „μš©μœΌλ‘œ μ„€μ •ν•˜μ—¬ μˆ˜μ •ν•  수 μ—†κ²Œ μ„€μ •
<input readonly>
maxlength
μž…λ ₯ κ°€λŠ₯ν•œ μ΅œλŒ€ 문자 수λ₯Ό μ„€μ •
<input maxlength="20">
min
숫자 μž…λ ₯ ν•„λ“œμ˜ μ΅œμ†Œκ°’μ„ μ„€μ •
<input type="number" min="0">
max
숫자 μž…λ ₯ ν•„λ“œμ˜ μ΅œλŒ€κ°’μ„ μ„€μ •
<input type="number" max="100">
step
숫자 μž…λ ₯ ν•„λ“œμ˜ 증가 λ‹¨μœ„λ₯Ό μ„€μ •
<input type="number" step="5">
pattern
μž…λ ₯값에 λŒ€ν•œ μ •κ·œ ν‘œν˜„μ‹ νŒ¨ν„΄μ„ μ„€μ •
<input pattern="[A-Za-z]{3}">
νƒœκ·Έ
속성
μ„€λͺ…
μ˜ˆμ‹œ
<select>
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
<select name="country">
multiple
μ—¬λŸ¬ 개의 μ˜΅μ…˜μ„ 선택할 수 μžˆλ„λ‘ μ„€μ •
<select multiple>
size
λ“œλ‘­λ‹€μš΄ λͺ©λ‘μ˜ ν‘œμ‹œλ˜λŠ” ν•­λͺ© 수λ₯Ό μ„€μ •
<select size="5">
disabled
λ“œλ‘­λ‹€μš΄ 메뉴λ₯Ό λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ 선택할 수 μ—†κ²Œ μ„€μ •
<select disabled>
νƒœκ·Έ
속성
μ„€λͺ…
μ˜ˆμ‹œ
<textarea>
name
μ„œλ²„λ‘œ 전솑될 λ°μ΄ν„°μ˜ 이름을 지정
<textarea name="comments">
rows
ν…μŠ€νŠΈ μ˜μ—­μ˜ μ„Έλ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (쀄 수)
<textarea rows="5">
cols
ν…μŠ€νŠΈ μ˜μ—­μ˜ κ°€λ‘œ 크기λ₯Ό 쀄 수 μžˆλŠ” 속성 (μ—΄ 수)
<textarea cols="30">
placeholder
μ‚¬μš©μžκ°€ μž…λ ₯ν•˜κΈ° μ „κΉŒμ§€ ν‘œμ‹œλ˜λŠ” 힌트 ν…μŠ€νŠΈ
<textarea placeholder="Enter your comments here">
required
μž…λ ₯ ν•„λ“œλ₯Ό ν•„μˆ˜ ν•­λͺ©μœΌλ‘œ μ„€μ •
<textarea required></textarea>
disabled
ν…μŠ€νŠΈ μ˜μ—­μ„ λΉ„ν™œμ„±ν™”ν•˜μ—¬ μ‚¬μš©μžκ°€ μž…λ ₯ν•  수 μ—†κ²Œ μ„€μ •
<textarea disabled></textarea>
readonly
ν…μŠ€νŠΈ μ˜μ—­μ„ 읽기 μ „μš©μœΌλ‘œ μ„€μ •ν•˜μ—¬ μˆ˜μ •ν•  수 μ—†κ²Œ μ„€μ •
<textarea readonly></textarea>
wrap
ν…μŠ€νŠΈ 쀄 λ°”κΏˆ 방식을 μ„€μ • (soft, hard)
<textarea wrap="soft"></textarea>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>μž…λ ₯ 양식 μ˜΅μ…˜</title> </head> <body> <h1>μž…λ ₯ 양식 μ˜΅μ…˜</h1> <form action="option" method="post"> <label for="test1">ν•„μˆ˜ μž…λ ₯ (required)</label> <input type="text" name="test1" id="test1" required> <br> <label for="test2">읽기 μ „μš© (readonly)</label> <input type="text" name="test2" id="test2" value="읽기 μ „μš©" readonly> <br> <label for="test3">μ‚¬μš© λΆˆκ°€ (disabled)</label> <input type="text" name="test3" id="test3" value="μ‚¬μš© λΆˆκ°€" disabled> <br> <label for="test4">일반 μž…λ ₯</label> <input type="text" name="test4" id="test4" value="κΈ°λ³Έκ°’"> <br> <label for="test5">μžλ™ 포컀싱 (autofocus)</label> <input type="text" name="test5" id="test5" autofocus> <br> <label for="test6">μˆ¨κΉ€ 데이터</label> <input type="hidden" name="boardNo" id="test6" value="100"> <br> <input type="submit" value="등둝"> </form> </body> </html>
HTML
볡사