Project Exercise — Survey Form
freeCodeCamp —- Responsive Web Dedign
Survey Form —— Test
Objective:
Build an app that is functionally similar to https://survey-form.freecodecamp.rocks
**User Stories:**【The requirements are as follows】
You should have a page title in an
h1
element with anid
oftitle
You should have a short explanation in a
p
element with anid
ofdescription
You should have a
form
element with anid
ofsurvey-form
Inside the form element, you are required to enter your name in an
input
field that has anid
ofname
and atype
oftext
Inside the form element, you are required to enter your email in an
input
field that has anid
ofemail
If you enter an email that is not formatted correctly, you will see an HTML5 validation error
Inside the form, you can enter a number in an
input
field that has anid
ofnumber
The number input should not accept non-numbers, either by preventing you from typing them or by showing an HTML5 validation error (depending on your browser).
If you enter numbers outside the range of the number input, which are defined by the
min
andmax
attributes, you will see an HTML5 validation errorFor the name, email, and number input fields, you can see corresponding
label
elements in the form, that describe the purpose of each field with the following ids:id="name-label"
,id="email-label"
, andid="number-label"
For the name, email, and number input fields, you can see placeholder text that gives a description or instructions for each field
Inside the form element, you should have a
select
dropdown element with anid
ofdropdown
and at least two options to choose fromInside the form element, you can select an option from a group of at least two radio buttons that are grouped using the
name
attributeInside the form element, you can select several fields from a series of checkboxes, each of which must have a
value
attributeInside the form element, you are presented with a
textarea
for additional commentsInside the form element, you are presented with a button with
id
ofsubmit
to submit all the inputs1
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
<head>
</head>
<body>
<h1 id="title">免费代码营调查表</h1>
<p id="description">感谢您抽出宝贵时间帮助我们改进平台</p>
<form id="survey-form">
<label for="name-label" id="name-label">名字:
<input id="name" type="text" placeholder="请输入你的名字" required></input>
</label>
<br>
<label for="email-label" id="email-label">电子邮箱:
<input id="email" type="email" placeholder="请输入你的电子邮箱" required></input>
</label>
<br>
<label for="number-label" id="number-label">年龄:
<input id="number" type="number" min="14" max="120" placeholder="年龄" required></input>
</label>
<br>
<label> 哪个角色更适合你?
<select id="dropdown">
<!-- <input>哪个角色最适合你?</input> -->
<option value=''>选择你当前角色</option>
<option value='1'>学生</option>
<option value='2'>社畜</option>
<option value='3'>保密</option>
</select>
</label>
<br>
<label>你觉得怎么样?
<input type="radio" name="evaluate" value="1">很好</input>
<input type="radio" name="evaluate" value="2">一般</input>
<input type="radio" name="evaluate" value="3">不咋样</input>
</label>
<br>
<label>你希望看到什么?
<input type="checkbox" value="0">前端项目</input>
<input type="checkbox" value="1">后端项目</input>
<input type="checkbox" value="2">游戏项目</input>
<input type="checkbox" value="3">sex项目</input>
</label>
<br>
<label>有什么意见或建议吗?
<textarea id="bio" rows="3" cols="20" placeholder="请写出你的想法"></textarea>
</label>
<input type="submit" id="submit"></input>
</form>
</body>
</html>
修改版
1 |
|
1 |