-
Notifications
You must be signed in to change notification settings - Fork 4
/
task2.html
54 lines (51 loc) · 1.55 KB
/
task2.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>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Day20-21</title>
<style>
select {
display: none;
}
</style>
</head>
<body>
<label>
<input id="school" name="status" type="radio">
School
</label>
<label>
<input id="company" name="status" type="radio">
Company
</label>
<select id="school-select">
<option>北京邮电大学</option>
<option>黑龙江大学</option>
<option>华中科技大学</option>
</select>
<select id="company-select">
<option>百度</option>
<option>爱奇艺</option>
</select>
<script>
function showSchool(event) {
document.querySelector("#school-select").style.display = "inline-block";
}
function showCompany(event) {
document.querySelector("#company-select").style.display = "inline-block";
}
function hiddenSchool(event) {
document.querySelector("#school-select").style.display = "none";
}
function hiddenCompany(event) {
document.querySelector("#company-select").style.display = "none";
}
document.querySelector("#school").addEventListener("click", showSchool);
document.querySelector("#school").addEventListener("click", hiddenCompany);
document.querySelector("#company").addEventListener("click", showCompany);
document.querySelector("#company").addEventListener("click", hiddenSchool);
</script>
</body>
</html>