-
Notifications
You must be signed in to change notification settings - Fork 0
/
co2-5.html
54 lines (48 loc) · 1.56 KB
/
co2-5.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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image</title>
<style>
.row {
width: 100%;
height: 100%;
}
img{
background-repeat: no-repeat;
display: block;
margin-left: auto;
margin-right: auto;
border: 8px ridge rgb(7, 7, 8);
padding: 5px;
width: 20%;
height:50%;
}
#heading1,#heading2{
text-align: center;
display:block;
}
</style>
</head>
<body>
<div class="content" id="content">
<img src="pic.jpg" id="image"><br><br>
<h1 id="heading1">mouse hover here</h1>
<h1 id="heading2">hello world</h1>
</div>
<script>
document.getElementById("content").addEventListener("mouseover",change1);
document.getElementById("content").addEventListener("mouseout",change2);
function change1(){
document.getElementById('image').src = "pic.jpg";
document.getElementById('heading1').style.display="none";
document.getElementById('heading2').style.display="block";
}
function change2(){
document.getElementById('image').src = "pic2.jpg";
document.getElementById('heading1').style.display="block";
document.getElementById('heading2').style.display="none";
}
</script>
</body>
</html>