-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path45(鼠标事件练习3).html
51 lines (48 loc) · 1.13 KB
/
45(鼠标事件练习3).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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
body{
background: wheat;
}
#waik,#red,#blue,#green,#pink{
width: 500px;
height: 100px;
text-align: center;
}
#red{background: red;}
#blue{background: cadetblue;}
#green{background: green;}
#pink{background: hotpink;}
</style>
<script type="text/javascript">
window.onload = function(){
document.getElementById("red").onclick = function(){
document.body.style.background = "red"
}
document.getElementById("blue").onclick = function(){
document.body.style.backgroundColor = "blue";
}
document.getElementById("green").onclick = function(){
document.body.style.backgroundColor = "green";
}
document.getElementById("pink").onclick = function(){
document.body.style.backgroundColor = "pink";
}
}
setTimeout(function(){
document.write("效果停止啦")
},4000);
</script>
</head>
<body>
<div id="waik">
<div id="red">1</div>
<div id="blue">2</div>
<div id="green">3</div>
<div id="pink">4</div>
</div>
</body>
</html>