Skip to content

Commit 270f9b4

Browse files
Charlene TranCharlene Tran
Charlene Tran
authored and
Charlene Tran
committed
created, added Exercises duplicate file for CT-edit
1 parent 577d7d0 commit 270f9b4

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

css/exercises-CT/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
body {
1010
background-color: yellow;
1111
}
12-
12+
1313
h1 {
1414
font-size: 36px;
1515
/* text-align: center; */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Flight Simulator</title>
5+
<link rel="stylesheet" type="text/css" href="style.css"/>
6+
<script src = "script.js"></script>
7+
</head>
8+
<body>
9+
<h1>Flight Simulator</h1>
10+
<p id="statusReport">The shuttle is on the ground</p>
11+
<button id = "liftoffButton">Take off</button>
12+
<button id = "abortMission">Abort mission</button>
13+
</body>
14+
</html>

dom-and-events/exercises-CT/script.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
function init () {
2+
const missionAbort = document.getElementById("abortMission");
3+
const button = document.getElementById("liftoffButton");
4+
const paragraph = document.getElementById("statusReport");
5+
6+
// Put your code for the exercises here.
7+
8+
button.addEventListener("click", function(event) {
9+
paragraph.innerHTML = "Houston, we have liftoff!";
10+
// console.log(paragraph);
11+
});
12+
13+
missionAbort.addEventListener("mouseover", function(event) {
14+
missionAbort.style.backgroundColor = "red";
15+
console.log("Click to ABORT MISSION!");
16+
17+
});
18+
19+
missionAbort.addEventListener("mouseout", function(event) {
20+
missionAbort.style.backgroundColor = "";
21+
});
22+
23+
missionAbort.addEventListener("click", function(event) {
24+
let response = window.confirm("Are you sure you want to abort the mission?");
25+
26+
if (response) {
27+
paragraph.innerHTML = "Mission aborted! Space shuttle returning home";
28+
} else {
29+
paragraph.innerHTML = "Mission is NOT aborted! Space shuttle en route!";
30+
}
31+
});
32+
33+
}
34+
35+
window.addEventListener("load", init);

dom-and-events/exercises-CT/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1 {
2+
text-decoration: underline;
3+
}

0 commit comments

Comments
 (0)