Skip to content

Commit 2edeb92

Browse files
committed
dom and events
1 parent 1e8633c commit 2edeb92

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

dom-and-events/exercises/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>Flight Simulator</title>
55
<link rel="stylesheet" type="text/css" href="style.css"/>
6-
<script src = "script.js"></script>
6+
<script src = "C:\Users\tdube\Desktop\trylaunchcode\javascript-projects\dom-and-events\exercises\script.js"></script>
77
</head>
88
<body>
99
<h1>Flight Simulator</h1>

dom-and-events/exercises/script.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ function init () {
44
const paragraph = document.getElementById("statusReport");
55

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

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

0 commit comments

Comments
 (0)