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】
  1. You should have a page title in an h1 element with an id of title

  2. You should have a short explanation in a p element with an id of description

  3. You should have a form element with an id of survey-form

  4. Inside the form element, you are required to enter your name in an input field that has an id of name and a type of text

  5. Inside the form element, you are required to enter your email in an input field that has an id of email

  6. If you enter an email that is not formatted correctly, you will see an HTML5 validation error

  7. Inside the form, you can enter a number in an input field that has an id of number

  8. 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).

  9. If you enter numbers outside the range of the number input, which are defined by the min and max attributes, you will see an HTML5 validation error

  10. For 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", and id="number-label"

  11. For the name, email, and number input fields, you can see placeholder text that gives a description or instructions for each field

  12. Inside the form element, you should have a select dropdown element with an id of dropdown and at least two options to choose from

  13. Inside the form element, you can select an option from a group of at least two radio buttons that are grouped using the name attribute

  14. Inside the form element, you can select several fields from a series of checkboxes, each of which must have a value attribute

  15. Inside the form element, you are presented with a textarea for additional comments

  16. Inside the form element, you are presented with a button with id of submit to submit all the inputs

    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
    <!DOCTYPE html>
    <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
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
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
<h1 id="title">免费代码营调查表</h1>
<p id="description">感谢您抽出宝贵时间帮助我们改进平台</p>
<form id="survey-form">
<div class="control">
<label for="name-label" id="name-label">名字:</label>
<input id="name" type="text" placeholder="请输入你的名字" class="form-control" required></input>
</div>
<div class="control">
<label for="email-label" id="email-label">电子邮箱:</label>
<input id="email" type="email" placeholder="请输入你的电子邮箱" class="form-control" required></input>
</div>
<div class="control">
<label for="number-label" id="number-label" >年龄:</label>
<input id="number" type="number" min="14" max="120" placeholder="年龄" class="form-control" required></input>
</div>
<div class="control">
<label> 哪个角色更适合你? </label>
<select id="dropdown" class="form-control">
<!-- <input>哪个角色最适合你?</input> -->
<option value=''>选择你当前角色</option>
<option value='1'>学生</option>
<option value='2'>社畜</option>
<option value='3'>保密</option>
</select>
</div>
<div class="control">
<label>你觉得怎么样?</label>
<input type="radio" name="evaluate" value="1" class="input-radio">很好</input>
<input type="radio" name="evaluate" value="2" class="input-radio">一般</input>
<input type="radio" name="evaluate" value="3" class="input-radio">不咋样</input>
</div>
<div class="control">
<label>你希望看到什么?</label>
<input type="checkbox" value="0" class="input-checkbox">前端项目</input>
<input type="checkbox" value="1" class="input-checkbox">后端项目</input>
<input type="checkbox" value="2" class="input-checkbox">游戏项目</input>
<input type="checkbox" value="3" class="input-checkbox">**项目</input>
</div>
<div class="control">
<label>有什么意见或建议吗?</label>
<textarea id="bio" rows="3" cols="20" placeholder="请写出你的想法"></textarea>
</div>
<input type="submit" id="submit"></input>
</form>
</div>
</body>
</html>
1