// QUESTION 5 : JS AND DOM //
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let newH1 = document.createElement("h1");
newH1.textContent = "Good Morning Haiku From the Cat";
document.body.prepend(newH1);
let newP = document.createElement("p");
newP.textContent = "In the morning light. You sleep despite my meow. I stand on your face."
document.body.append(newP);
let newH1_2 = document.createElement("h1");
newH1_2.textContent = "Good Morning Haiku From Anyone";
document.body.append(newH1_2);
let newP2 = document.createElement("p");
newP2.textContent = "Roses are red. Violets are blue. I don't understand Haiku's. I did this wrong."
document.body.append(newP2);
document.querySelectorAll("h1").forEach(
(h1) => h1.style.color = "red");
document.querySelectorAll("p").forEach(
(p) => p.style.color = "blue");
</script>
</body>
</html>
// QUESTION 6 JS and Event Listeners //
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Evaluation</title>
</head>
<body>
<h1>Manage Colors</h1>
<ul>
<li id="red"></li>
<li id="green"></li>
<li id="blue"></li>
</ul>
<div id="target">
</div>
<script>
var buttonRouge = document.getElementById("red");
var buttonVert = document.getElementById("green");
var buttonBleu = document.getElementById("blue");
buttonRouge.addEventListener("click", changeBackground);
buttonVert.addEventListener("click", changeBackground);
buttonBleu.addEventListener("click", changeBackground);
function changeBackground(event) {
var CouleurId = event.target.id;
document.getElementById("target").style.backgroundColor = CouleurId;
}
</script>
</body>
</html>