Skip to content

Commit a1a0b11

Browse files
committed
Dom and Events 1
1 parent 2902618 commit a1a0b11

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

My computer Git Exercises

Whitespace-only changes.

css/exercises/HTML-Me-Something-Start

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit bf2d4c033c22daed6d16cf4868d508bc56c889d6

css/exercises/HTML-Me-Something-Start.git

Whitespace-only changes.

dom-and-events/exercises/script.js

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

66
// Put your code for the exercises here.
7-
7+
// Task 1
8+
document.getElementById('liftoffButton').addEventListener('click', function() {
9+
document.getElementById('status').innerText = 'Houston, we have liftoff!';
10+
});
11+
12+
// Task 2
13+
document.getElementById('abortMission').addEventListener('mouseover', function() {
14+
this.style.backgroundColor = 'red';
15+
});
16+
17+
// Task 3
18+
document.getElementById('abortMission').addEventListener('mouseout', function() {
19+
this.style.backgroundColor = '';
20+
});
21+
22+
// Task 4
23+
document.getElementById('abortMission').addEventListener('click', function() {
24+
if (confirm('Are you sure you want to abort the mission?')) {
25+
document.getElementById('status').innerText = 'Mission aborted! Space shuttle returning home.';
26+
}
27+
});
28+
829
}
930

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

0 commit comments

Comments
 (0)