Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .learn/resets/01-alert-on-click/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>
<body>
<button onclick="myClickFunction();">Click me</button>
and
<button onclick="myClickFunction();" id="button2">Don't click me</button>
<script src="index.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions .learn/resets/02-on-click-Hello-World/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>
<body>
<input id="hello" type="button" value="Press to show 'Hello world'" />
<script src="index.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions .learn/resets/03-sum-values/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>

<body>
<input id="firstNumber" type="text" value="" /> + <input id="secondNumber" type="text" value="" /> =
<input id="resultNumber" type="text" value="" />
<input type="button" value="Calculate" onclick="calculateSumListener();" />
<script src="index.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions .learn/resets/04-hide-on-click/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
<link rel="stylesheet" href="styles.css" />
</head>

<body>
<div id="firstDiv">
My first div
</div>
<div id="secondDiv">
My second div
</div>
<input type="button" value="Hide first div" onclick="myEventListener();" />
<script src="index.js"></script>
</body>

</html>
13 changes: 13 additions & 0 deletions .learn/resets/05-the-load-event/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>

<body>
<p>Hello! Please alert "Loading finished..." when this website finally loads.</p>
<script src="index.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions .learn/resets/06-add-listener-with-js/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
<style>
#theGreen {
background: green;
color: white
}
#theGreen:hover {
background: red;
}
</style>
</head>

<body>
<button id="theGreen">I am a green button</button>
<script src="index.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions .learn/resets/07-count-on-click/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>4Geeks Academy</title>
</head>

<body>
<h1 id="screen">Loading...</h1>
<button onclick="increaseCounter();">Increase</button>
<script src="index.js"></script>
</body>

</html>
13 changes: 13 additions & 0 deletions .learn/resets/07.1-change-turn-on-click/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>
<body>
<h1 id="screen">Loading...</h1>
<button onclick="turnChanger();">Switch turn</button>
<script src="index.js"></script>
</body>
</html>
16 changes: 16 additions & 0 deletions .learn/resets/08-event-target/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>
<body>
<div id="container">
<button id="btn1">Click me</button>
<a id="anchor1" href="#">Click me</a>
<img id="img1" src="https://shahpourpouyan.com/wp-content/uploads/2018/10/orionthemes-placeholder-image-1.png" />
<script src="index.js"></script>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion exercises/01-alert-on-click/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<body>
<button onclick="myClickFunction();">Click me</button>
and
<button id="button2">Don't click me</button>
<button onclick="myClickFunction();" id="button2">Don't click me</button>
<script src="index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion exercises/02-on-click-Hello-World/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>4Geeks Academy</title>
</head>
<body>
<input id="hello" type="button" value="Press to show 'Hello world'" />
<input id="hello" onclick="myClickFunction();" type="button" value="Press to show 'Hello world'" />
<script src="index.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions exercises/02-on-click-Hello-World/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// Declare your function here
window.myClickFunction = function myClickFunction() {
alert("Hello World");
console.log("line 4 working.");
}
3 changes: 2 additions & 1 deletion exercises/03-sum-values/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ window.calculateSumListener = function() {
// Return the value of the input #secondNumber
let stringB = document.getElementById("secondNumber").value;
// Your code here

let sum = parseInt(stringA) + parseInt(stringB);
document.getElementById("resultNumber").value = sum;
};
31 changes: 13 additions & 18 deletions exercises/04-hide-on-click/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
<link rel="stylesheet" href="styles.css" />
</head>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
<link rel="stylesheet" href="styles.css" />
</head>

<body>
<div id="firstDiv">
My first div
</div>
<div id="secondDiv">
My second div
</div>
<input type="button" value="Hide first div" onclick="myEventListener();" />
<script src="index.js"></script>
</body>

<body>
<div id="firstDiv">My first div</div>
<div id="secondDiv">My second div</div>
<input type="button" value="Hide first div" onclick="myEventListener();" />
<input type="button" value="Show first div" onclick="myEventListenerTwo();" />
<script src="index.js"></script>
</body>
</html>
7 changes: 6 additions & 1 deletion exercises/04-hide-on-click/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
window.myEventListener = function myEventListener() {
// Your code here

document.getElementById("firstDiv").style.display = "none";
}


window.myEventListenerTwo = function myEventListenerTwo() {
document.getElementById("firstDiv").style.display = "block";
}
2 changes: 1 addition & 1 deletion exercises/05-the-load-event/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>4Geeks Academy</title>
</head>

<body>
<body onload="loadListener();">
<p>Hello! Please alert "Loading finished..." when this website finally loads.</p>
<script src="index.js"></script>
</body>
Expand Down
3 changes: 3 additions & 0 deletions exercises/05-the-load-event/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// Your function goes here
window.loadListener = function loadListener() {
alert("Loading finished...");
}
8 changes: 4 additions & 4 deletions exercises/06-add-listener-with-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
<style>
#theGreen {
background: green;
color: white
}
#theGreen {
background: green;
color: white;
}
#theGreen:hover {
background: red;
}
Expand Down
5 changes: 4 additions & 1 deletion exercises/06-add-listener-with-js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
window.onload = function myLoadFunction() {
alert("The website just finished loading!");
// Some code here

document.getElementById("theGreen").addEventListener("click", clickFunction);
};

// The listener function here
function clickFunction() {
alert("woohoo!");
}
24 changes: 12 additions & 12 deletions exercises/07-count-on-click/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>4Geeks Academy</title>
</head>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>4Geeks Academy</title>
</head>

<body>
<h1 id="screen">Loading...</h1>
<button onclick="increaseCounter();">Increase</button>
<script src="index.js"></script>
</body>

<body>
<h1 id="screen">Loading...</h1>
<button onclick="increaseCounter();">Increase</button>
<button onclick="decreaseCounter();">Decrease</button>
&nbsp;
<script src="index.js"></script>
</body>
</html>
5 changes: 4 additions & 1 deletion exercises/07-count-on-click/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ window.increaseCounter = function increaseCounter()
}

// Your code here

window.decreaseCounter = function decreaseCounter() {
counter--;
document.getElementById('screen').innerHTML = `the counter value is ${counter}.`
}
3 changes: 3 additions & 0 deletions exercises/07.1-change-turn-on-click/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ window.onload = function loadfn() {

// Modify this function
window.turnChanger = function turnChanger() {
console.log("click detected.")
if (currentUser == "Mario") {
currentUser = "Juan";
} else if (currentUser == "Juan") {
currentUser = "Josh";
} else {
currentUser = "Mario";
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/08-event-target/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ window.onload = function loadFn() {
let containerElm = document.getElementById("container");
containerElm.addEventListener("click", function(event) {
// Your code here

alert(event.target.id)
});
};