Skip to content

Commit

Permalink
session 19: event
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeeppy committed Apr 21, 2023
1 parent 3029da4 commit 2616259
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
16 changes: 16 additions & 0 deletions session19/challenge1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Session 19</title>
</head>
<body>
<a href="#">Supprimer cet article</a>

<button>Passez au dessus de moi</button>

<script src="script.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions session19/challenge1/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let a = document.querySelector("a")
let button = document.querySelector("button");

a.onclick = () => {
if (confirm("Êtes-vous sûr ?")) {
location.href= "http://www.google.com";
}
};

button.onmouseover = () => {
document.querySelector('body').style.backgroundColor = "#fcae1e";
}

button.onmouseleave = () => {
document.querySelector('body').style.backgroundColor = "#ffffff";
}
16 changes: 16 additions & 0 deletions session19/challenge2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Session 19</title>
</head>
<body>
<a href="#">Supprimer cet article</a>

<button>Passez au dessus de moi</button>

<script src="script.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions session19/challenge2/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let a = document.querySelector('a');
let button = document.querySelector('button');

a.addEventListener('click', (e) => {
if (confirm("Êtes-vous sûr ?")) {
location.href= "http://www.google.com";
}
});

button.addEventListener('mouseover', () => {
document.querySelector('body').style.backgroundColor = "#fcae1e";
});
button.addEventListener('mouseleave', () => {
document.querySelector('body').style.backgroundColor = "#ffffff";
});

0 comments on commit 2616259

Please sign in to comment.