Skip to content

Commit c20ccc2

Browse files
June LeeJune Lee
authored andcommitted
completed studio pt 1-2
1 parent 9e313a3 commit c20ccc2

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

dom-and-events/studio/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ <h3>Space Shuttle Height</h3>
3737
<button id = "missionAbort">Abort Mission</button>
3838
</div>
3939
</body>
40-
</html>
40+
</html>

dom-and-events/studio/scripts.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,28 @@
1-
// Write your JavaScript code here.
2-
// Remember to pay attention to page loading!
1+
function gitLit(){
2+
const takeoff = document.getElementById("takeoff");
3+
const flightStatus = document.getElementById("flightStatus");
4+
const shuttleBackground = document.getElementById("shuttleBackground");
5+
const spaceShuttleHeight = document.getElementById("spaceShuttleHeight");
6+
7+
const land = document.getElementById("landing");
8+
9+
takeoff.addEventListener('click', event =>{
10+
let response =window.confirm("Confirm that the shuttle is ready for takeoff.");
11+
12+
if(response){
13+
flightStatus.innerHTML = "Shuttle in flight.";
14+
shuttleBackground.style.backgroundColor = "blue";
15+
spaceShuttleHeight.innerHTML = 10000;
16+
}
17+
});
18+
19+
land.addEventListener('click', event => {
20+
let response = window.confirm("The shuttle is landing. Landing gear engaged.");
21+
22+
if(response){
23+
flightStatus.innerHTML = "The shuttle has landed.";
24+
}
25+
})
26+
27+
}
28+
window.addEventListener("load", gitLit);

0 commit comments

Comments
 (0)