-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheartBackground.html
34 lines (29 loc) · 958 Bytes
/
heartBackground.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
<!DOCTYPE html>
<html>
<head>
<title>Heart Background</title>
<link href="./heartBackground.css" rel="stylesheet" type="text/css">
</head>
<body>
<section class="container">
<img src="normal.png" id="myImage">
<p onclick="blooming()" id="word">Click for a secret message</p>
</section>
<!-- Paste your code in the script element below: -->
<script>
function blooming() {
let image = document.getElementById('myImage');
let word = document.getElementById('word');
if (image.src.match("normal")) {
image.src = "hearts.png";
word.style = "color: rebeccapurple";
word.innerHTML = "Becca loves to code";
} else {
image.src = "normal.png";
word.style.color = "lavender";
word.innerHTML = "Becca creates things";
}
}
</script>
</body>
</html>