Skip to content

Commit f9b4ea9

Browse files
committed
Exercise complete
1 parent 96ef24d commit f9b4ea9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

dom-and-events/exercises/script.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,24 @@ function init () {
33
const button = document.getElementById("liftoffButton");
44
const paragraph = document.getElementById("statusReport");
55

6-
// Put your code for the exercises here.
7-
6+
button.addEventListener('click', event => {
7+
paragraph.innerHTML = 'Houston, we have liftoff!';
8+
});
9+
10+
function abortFunc() {
11+
let abortMission = window.confirm("Are you sure you want to abort the mission?");
12+
if (abortMission){
13+
paragraph.innerHTML = 'Mission aborted! Space shuttle returning home';
14+
}
15+
}
16+
missionAbort.addEventListener('click', abortFunc);
17+
18+
missionAbort.addEventListener("mouseover", event => {
19+
missionAbort.style.backgroundColor = "red";
20+
})
21+
missionAbort.addEventListener("mouseout", event => {
22+
missionAbort.style.backgroundColor = "";
23+
})
824
}
925

1026
window.addEventListener("load", init);

0 commit comments

Comments
 (0)