-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathscripts.js
More file actions
39 lines (37 loc) · 1.31 KB
/
scripts.js
File metadata and controls
39 lines (37 loc) · 1.31 KB
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
35
36
37
38
39
// Write your JavaScript code here.
// Remember to pay attention to page loading!
window.addEventListener("load",function(event){
let takeoff=document.getElementById("takeoff");
let status=document.getElementById("flightStatus");
let background=document.getElementById("shuttleBackground");
let shuttleHeight=document.getElementById("spaceShuttleHeight");
let land=document.getElementById("landing");
let abort=document.getElementById("missionAbort");
takeoff.addEventListener("click",function(event){
let response=window.confirm("Confirm that the shuttle is ready for takeoff");
if(response)
{
status.innerHTML="Shuttle in flight.";
background.style.backgroundColor="blue";
shuttleHeight.innerHTML=10000;
}
})
land.addEventListener("click",function(event){
let response=window.confirm("The shuttle is landing. Landing gear engaged.");
if(response)
{
status.innerHTML="The shuttle has landed.";
background.style.backgroundColor="green";
shuttleHeight.innerHTML=0;
}
})
abort.addEventListener("click",function(event){
let response=window.confirm("Confirm that you want to abort the mission.");
if(response)
{
status.innerHTML="Mission aborted.";
background.style.backgroundColor="green";
shuttleHeight.innerHTML=0;
}
})
})