-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solves the exercise and finish the course
- Loading branch information
1 parent
1a1073e
commit ab96aff
Showing
9 changed files
with
93 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Test</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="stylesheet" type="" href="../../josh-reset.css" /> | ||
<link rel="stylesheet" type="" href="../../style.css" /> | ||
<link rel="stylesheet" type="" href="test.css" /> | ||
<script src="test.js" async></script> | ||
</head> | ||
<body> | ||
<div id="first-parent"> | ||
<h1> | ||
<a href="../../index.html"> Exercise about getElementsByClassName()</a> | ||
</h1> | ||
</div> | ||
|
||
<div id="list-container"> | ||
<div class="container"> | ||
<button onclick="green()" class="green undo"> | ||
Click to change this to Mint Green | ||
</button> | ||
<button onclick="blue()" class="blue undo"> | ||
Click to change this to Powder Blue | ||
</button> | ||
<button onclick="red()" class="red undo"> | ||
Click to change this to Orchid Pink | ||
</button> | ||
<button onclick="undo()">Undo painting</button> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
const painter = (className, colorName) => { | ||
document.getElementsByClassName(className)[0].style.backgroundColor = | ||
colorName; | ||
document.getElementsByClassName(className)[0].style.color = "whitesmoke"; | ||
}; | ||
|
||
function green() { | ||
painter("green", "green"); | ||
painter("green", "#BADFD1"); | ||
} | ||
|
||
function blue() { | ||
painter("blue", "blue"); | ||
painter("blue", "#ACCCF1"); | ||
} | ||
|
||
function red() { | ||
painter("red", "red"); | ||
painter("red", "#F2B4B8"); | ||
} | ||
|
||
function undo() { | ||
const elems = document.getElementsByClassName("undo"); | ||
for (let i = 0; i < elems.length; i++) { | ||
elems[i].style.backgroundColor = "black"; | ||
elems[i].style.backgroundColor = "#fbe9ec"; | ||
elems[i].style.color = "#4a4e69"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.