-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path选项卡
51 lines (50 loc) · 1.24 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<style>
#div1 input{
background:white;
}
#div1 input.active {
background:yellow;
}
#div1 div {
width:200px;height:200px;background:#ccc;display:none;
}
</style>
<script>
window.onload = function ()
{
var oDiv = document.getElementById('div1');
var aBtn = oDiv.getElementsByTagName('input');
var aDiv = oDiv.getElementsByTagName('div');
for (var i = 0; i < aBtn.length; i++)
{
aBtn[i].index = i;
aBtn[i].onclick = function ()
{
for (var i = 0; i < aBtn.length; i++) {
aBtn[i].className = '';
aDiv[i].style.display = 'none';
}
this.className = 'active';
aDiv[this.index].style.display='block';
}
}
}
</script>
<body>
<div id="div1">
<input class="active" type="button" value="aaa"/>
<input type="button" value="bbb" />
<input type="button" value="ccc" />
<div>sdlklajd</div>
<div>jksd</div>
<div>dlsak</div>
</div>
</body>
</html>