Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
47 lines (40 loc) · 1.38 KB

File metadata and controls

47 lines (40 loc) · 1.38 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>getElementsByTagName</title>
<script type="application/javascript">
function checkAll(){
//getElementsByTagName 返回多个dom对象集合
var hobbys=document.getElementsByTagName("input")
for(var index=0;index<hobbys.length;index++){
// alert(hobbys[index]+" "+hobbys[index].checked);
// alert(hobbys[index].checked);
hobbys[index].checked=true;
}
};
function checkNo(){
var hobbys=document.getElementsByTagName("input")
for(var index=0;index<hobbys.length;index++){
hobbys[index].checked=false;
}
};
function checkReverse(){
var hobbys=document.getElementsByTagName("input")
for(var index=0;index<hobbys.length;index++){
hobbys[index].checked=!(hobbys[index].checked);
}
};
</script>
</head>
<body>
兴趣爱好:<br>
<input type="checkbox" value="cpp">CPP<br>
<input type="checkbox" value="Java">Java<br>
<input type="checkbox" value="C++">C++<br>
<input type="checkbox" value="JavaScript">JavaScript<br>
<button onclick="checkAll()">全选</button>
<button onclick="checkNo()">全部选</button>
<button onclick="checkReverse()">反选</button>
</body>
</html>
Morty Proxy This is a proxified and sanitized view of the page, visit original site.