-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocWithTable&Form,FindFieldsOfForm.html
More file actions
68 lines (59 loc) · 1.47 KB
/
Copy pathdocWithTable&Form,FindFieldsOfForm.html
File metadata and controls
68 lines (59 loc) · 1.47 KB
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
<!DOCTYPE html>
<html>
<head>
<title>DOM</title>
</head>
<body>
<form name="search">
<label>Search the site:
<input type="text" name="search">
</label>
<input type="submit" value="Search!">
</form>
<hr>
<form name="search-person">
Search the visitors:
<table id="age-table">
<tbody>
<tr>
<td>Age:</td>
<td id="age-list">
<label>
<input type="radio" name="age" value="young">less than 18
</label>
<label>
<input type="radio" name="age" value="mature">18-50
</label>
<label>
<input type="radio" name="age" value="senior">more than 50
</label>
</td>
</tr>
<tr>
<td>Additionally:</td>
<td>
<input type="text" name="info[0]">
<input type="text" name="info[1]">
<input type="text" name="info[2]">
</td>
</tr>
</tbody>
</table>
<input type="submit" value="Search!">
</form>
<script>
let age1 = document.getElementById('age-table');
console.log(age1);
let age2 = document.getElementsByTagName('label');
console.log(age2);
let age3 = document.getElementsByTagName('td')[0];
console.log(age3);
let age4 = document.getElementsByName('search');
console.log(age4);
let age5 = document.getElementsByTagName('input')[0];
console.log(age5);
let age6 = document.querySelectorAll('input');
console.log(age6[age6.length-1]);
</script>
</body>
</html>