-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.html
258 lines (249 loc) · 10.4 KB
/
forms.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HTML5 form example</title>
<style>
* { box-sizing: border-box; }
section { margin: 3em 0; }
fieldset { margin-bottom: 1em; }
legend { font-weight: 700; }
</style>
</head>
<body>
<h1>HTML5 forms</h1>
<section>
<h2>datalist element</h2>
<fieldset>
<legend>input list="local-list" + datalist id="local-list"</legend>
<label for="local">지역번호:</label>
<input type="text" id="local" list="local-list">
<datalist id="local-list">
<option value="02" label="서울"></option>
<option value="031" label="경기"></option>
</datalist>
</fieldset>
</section>
<section>
<h2>output element</h2>
<form method="post" oninput="x.value=parseInt(a.value)+parseInt(b.value)">
<fieldset>
<legend>form oninput="<strong>x</strong>.value=parseInt(<strong>a</strong>.value)+parseInt(<strong>b</strong>.value)"</legend>
<input type="range" name="a" value="50">
+
<input type="range" name="b" value="50">
=
<output name="x" for="a b" style="font-weight:bold">108</output>
</fieldset>
</form>
<form method="post" oninput="y.value=parseInt(c.value)+parseInt(d.value)">
<fieldset>
<legend>form oninput="<strong>y</strong>.value=parseInt(<strong>c</strong>.value)+parseInt(<strong>d</strong>.value)"</legend>
<input type="number" name="c" value="50">
+
<input type="number" name="d" value="50">
=
<output name="y" for="c d" style="font-weight:bold">100</output>
</fieldset>
</form>
</section>
<section>
<h2>progress element</h2>
<fieldset>
<legend>progress value="0.5"</legend>
<progress value="0.5">0.5/1</progress>
<br>
<progress value="50" max="100">50/100</progress>
<p>min 속성은 존재하지 않음. max 속성 생략시 기본 값은 1.</p>
</fieldset>
</section>
<section>
<h2>meter element</h2>
<fieldset>
<legend>meter value="0.5"</legend>
<meter value="0.5">0.5/1</meter>
<br>
<meter value="50" max="100">50/100</meter>
<p>min/max 속성 생략시 기본 값은 0/1이 된다. 'low, high, optimum' 속성을 사용하면 '낮은 범위, 높은 범위, 적정 값'을 명시할 수 있음.</p>
</fieldset>
</section>
<section>
<h2>input [type] attributes</h2>
<fieldset>
<legend>input type="search"</legend>
<label for="search">검색:</label>
<input type="search" id="search" autocomplete="on" required>
</fieldset>
<fieldset>
<legend>input type="tel"</legend>
<label for="tel">전화번호:</label>
<input type="tel" id="tel" required>
</fieldset>
<fieldset>
<legend>input type="url"</legend>
<label for="url">웹 사이트:</label>
<input type="url" id="url" required placeholder="http://">
</fieldset>
<fieldset>
<legend>input type="email"</legend>
<label for="email">이메일:</label>
<input type="email" id="email" required placeholder="[email protected]">
</fieldset>
<fieldset>
<legend>input type="number"</legend>
<label for="number">숫자:</label>
<input type="number" id="number" required>
</fieldset>
<fieldset>
<legend>input type="date"</legend>
<label for="date">날짜(년, 월, 일):</label>
<input type="date" id="date" required value="1975-12-24">
</fieldset>
<fieldset>
<legend>input type="month"</legend>
<label for="month">날짜(년, 월):</label>
<input type="month" id="month" required value="1975-12">
</fieldset>
<fieldset>
<legend>input type="week"</legend>
<label for="week">날짜(년, 주):</label>
<input type="week" id="week" required value="1975-W52">
</fieldset>
<fieldset>
<legend>input type="time"</legend>
<label for="time">시간(시, 분):</label>
<input type="time" id="time" required value="18:00">
</fieldset>
<fieldset>
<legend>input type="datetime-local"</legend>
<label for="datetime-local">날짜(년, 월, 일, 시, 분):</label>
<input type="datetime-local" id="datetime-local" required value="1975-12-24T06:09">
</fieldset>
<fieldset>
<legend>input type="range"</legend>
<label for="range">대략의 숫자 값:</label>
<input type="range" step="10" id="range" required min="0" max="100" value="50">
</fieldset>
<fieldset>
<legend>input type="color"</legend>
<label for="color">색상 선택:</label>
<input type="color" id="color" required>
</fieldset>
<fieldset>
<legend>input type="file" accept="image/*"</legend>
<label for="file">이미지 파일 선택:</label>
<input type="file" id="file" multiple required accept="image/*">
</fieldset>
</section>
<section>
<h2>input attributes</h2>
<form>
<fieldset>
<legend>input required</legend>
<label for="required">이메일:</label>
<input id="required" type="email" required placeholder="[email protected]">
<p>반드시 입력해야 합니다.</p>
<input type="submit">
</fieldset>
</form>
<fieldset>
<legend>input autocomplete="on"</legend>
<label for="autocompleteOn">자동완성 켬:</label>
<input type="text" id="autocompleteOn" autocomplete="on">
</fieldset>
<fieldset>
<legend>input autocomplete="off"</legend>
<label for="autocompleteOn">자동완성 끔:</label>
<input type="text" id="autocompleteOff" autocomplete="off">
</fieldset>
<fieldset>
<legend>input autofocus="autofocus"</legend>
<label for="autofocus">자동 포커스:</label>
<input type="text" id="autofocus" autofocus>
</fieldset>
<fieldset>
<legend>input placeholder="[email protected]"</legend>
<label for="placeholder">이메일:</label>
<input type="text" id="placeholder" placeholder="[email protected]" required>
</fieldset>
<fieldset>
<legend>input list="local-list" + datalist id="local-list"</legend>
<label for="local">지역번호:</label>
<input type="text" id="local" list="local-list">
<datalist id="local-list">
<option value="02" label="서울"></option>
<option value="031" label="경기"></option>
</datalist>
</fieldset>
<fieldset>
<legend>input min="0" max="10"</legend>
<label for="minmax">숫자(최소/최대) 값:</label>
<input type="number" id="minmax" min="0" max="10" required>
</fieldset>
<fieldset>
<legend>input minlength="4" maxlength="8"</legend>
<label for="minmaxlength">문자(최소/최대) 길이:</label>
<input type="text" id="minmaxlength" minlength="4" maxlength="8" required>
</fieldset>
<fieldset>
<legend>input step="10"</legend>
<label for="level">스텝:</label>
<input name id="level" value type="number" min="0" max="100" step="10" required>
</fieldset>
<fieldset>
<legend>input type="email" multiple</legend>
<label for="multiple">이메일 목록:</label>
<input name type="email" id="multiple" value multiple required placeholder="[email protected]">
<p>쉼표(,)로 분리한 이메일 주소 목록.</p>
</fieldset>
<fieldset>
<legend>input type="file" multiple</legend>
<label for="multiple_file">여러 파일 첨부:</label>
<input name type="file" id="multiple_file" value multiple required>
</fieldset>
<fieldset>
<legend>select multiple</legend>
<label for="multiple_select">여러 값 선택:</label>
<select multiple="" id="multiple_select">
<option value="[email protected]">01</option>
<option value="[email protected]">02</option>
<option value="[email protected]">03</option>
</select>
<p><kbd>cmd</kbd> 또는 <kbd>ctrl</kbd> 키를 누른 상태로 여러 개의 값을 선택할 수 있다.</p>
</fieldset>
<fieldset>
<legend>input pattern="[0-9][0-9][0-1][0-9][0-3][0-9]-[1-4][0-9][0-9][0-9][0-9][0-9][0-9]"</legend>
<label for="pattern">정규 표현식 패턴:</label>
<input id="pattern" maxlength="14" pattern="[0-9][0-9][0-1][0-9][0-3][0-9]-[1-4][0-9][0-9][0-9][0-9][0-9][0-9]" required="" title="하이픈 '-' 기호를 포함해야 합니다."> <span></span>
<p>가상의 주민등록번호 입력 가능. 예) 000000-1000000</p>
</fieldset>
</section>
<section>
<h2>select element</h2>
<fieldset>
<legend>select, option</legend>
<select>
<option selected>선택 1</option>
<option>선택 2</option>
<option>선택 3</option>
</select>
</fieldset>
<fieldset>
<legend>select, optgruop, option</legend>
<select>
<optgroup label="그룹 1">
<option selected>선택 1-1</option>
<option>선택 1-2</option>
<option>선택 1-3</option>
</optgroup>
<optgroup label="그룹 2">
<option>선택 2-1</option>
<option>선택 2-2</option>
<option>선택 2-3</option>
</optgroup>
</select>
</fieldset>
</section>
</body>
</html>