From e36efb81171401ab0a783c90fdb55d1cc367ac45 Mon Sep 17 00:00:00 2001 From: Elkin Botero <147097939+eybagit@users.noreply.github.com> Date: Tue, 24 Jun 2025 23:50:05 +0000 Subject: [PATCH] EjerciciosRealizados --- .learn/resets/01-alert-on-click/index.html | 14 +++++++++ .learn/resets/01-alert-on-click/index.js | 3 ++ .../resets/02-on-click-Hello-World/index.html | 12 ++++++++ .../resets/02-on-click-Hello-World/index.js | 1 + .learn/resets/03-sum-values/index.html | 15 ++++++++++ .learn/resets/03-sum-values/index.js | 9 ++++++ .learn/resets/04-hide-on-click/index.html | 22 ++++++++++++++ .learn/resets/04-hide-on-click/index.js | 4 +++ .learn/resets/04-hide-on-click/styles.css | 6 ++++ .learn/resets/05-the-load-event/index.html | 13 ++++++++ .learn/resets/05-the-load-event/index.js | 1 + .../resets/06-add-listener-with-js/index.html | 22 ++++++++++++++ .../resets/06-add-listener-with-js/index.js | 7 +++++ .learn/resets/07-count-on-click/index.html | 16 ++++++++++ .learn/resets/07-count-on-click/index.js | 20 +++++++++++++ .../07.1-change-turn-on-click/index.html | 13 ++++++++ .../resets/07.1-change-turn-on-click/index.js | 16 ++++++++++ .learn/resets/08-event-target/index.html | 16 ++++++++++ .learn/resets/08-event-target/index.js | 7 +++++ exercises/01-alert-on-click/index.html | 4 ++- exercises/02-on-click-Hello-World/index.html | 2 +- exercises/02-on-click-Hello-World/index.js | 3 ++ exercises/03-sum-values/index.js | 5 ++++ exercises/04-hide-on-click/index.html | 30 ++++++++----------- exercises/04-hide-on-click/index.js | 3 +- exercises/05-the-load-event/index.html | 2 +- exercises/05-the-load-event/index.js | 3 ++ exercises/06-add-listener-with-js/index.html | 8 ++--- exercises/06-add-listener-with-js/index.js | 6 ++++ exercises/07-count-on-click/index.html | 23 +++++++------- exercises/07-count-on-click/index.js | 8 +++++ exercises/07.1-change-turn-on-click/index.js | 4 ++- exercises/08-event-target/index.js | 2 +- 33 files changed, 280 insertions(+), 40 deletions(-) create mode 100644 .learn/resets/01-alert-on-click/index.html create mode 100644 .learn/resets/01-alert-on-click/index.js create mode 100644 .learn/resets/02-on-click-Hello-World/index.html create mode 100644 .learn/resets/02-on-click-Hello-World/index.js create mode 100644 .learn/resets/03-sum-values/index.html create mode 100644 .learn/resets/03-sum-values/index.js create mode 100644 .learn/resets/04-hide-on-click/index.html create mode 100644 .learn/resets/04-hide-on-click/index.js create mode 100644 .learn/resets/04-hide-on-click/styles.css create mode 100644 .learn/resets/05-the-load-event/index.html create mode 100644 .learn/resets/05-the-load-event/index.js create mode 100644 .learn/resets/06-add-listener-with-js/index.html create mode 100644 .learn/resets/06-add-listener-with-js/index.js create mode 100644 .learn/resets/07-count-on-click/index.html create mode 100644 .learn/resets/07-count-on-click/index.js create mode 100644 .learn/resets/07.1-change-turn-on-click/index.html create mode 100644 .learn/resets/07.1-change-turn-on-click/index.js create mode 100644 .learn/resets/08-event-target/index.html create mode 100644 .learn/resets/08-event-target/index.js diff --git a/.learn/resets/01-alert-on-click/index.html b/.learn/resets/01-alert-on-click/index.html new file mode 100644 index 0000000..c7ae1e7 --- /dev/null +++ b/.learn/resets/01-alert-on-click/index.html @@ -0,0 +1,14 @@ + + + + + + 4Geeks Academy + + + + and + + + + diff --git a/.learn/resets/01-alert-on-click/index.js b/.learn/resets/01-alert-on-click/index.js new file mode 100644 index 0000000..b48dd36 --- /dev/null +++ b/.learn/resets/01-alert-on-click/index.js @@ -0,0 +1,3 @@ +window.myClickFunction = function myClickFunction() { + alert("Your first function!"); +}; diff --git a/.learn/resets/02-on-click-Hello-World/index.html b/.learn/resets/02-on-click-Hello-World/index.html new file mode 100644 index 0000000..ca7ada9 --- /dev/null +++ b/.learn/resets/02-on-click-Hello-World/index.html @@ -0,0 +1,12 @@ + + + + + + 4Geeks Academy + + + + + + diff --git a/.learn/resets/02-on-click-Hello-World/index.js b/.learn/resets/02-on-click-Hello-World/index.js new file mode 100644 index 0000000..dabc5b9 --- /dev/null +++ b/.learn/resets/02-on-click-Hello-World/index.js @@ -0,0 +1 @@ +// Declare your function here diff --git a/.learn/resets/03-sum-values/index.html b/.learn/resets/03-sum-values/index.html new file mode 100644 index 0000000..a61cdda --- /dev/null +++ b/.learn/resets/03-sum-values/index.html @@ -0,0 +1,15 @@ + + + + + + 4Geeks Academy + + + + + = + + + + + diff --git a/.learn/resets/03-sum-values/index.js b/.learn/resets/03-sum-values/index.js new file mode 100644 index 0000000..e3cc906 --- /dev/null +++ b/.learn/resets/03-sum-values/index.js @@ -0,0 +1,9 @@ +// Adding the function to the window makes it globally available +window.calculateSumListener = function() { + // Return the value of the input #firstNumber + let stringA = document.getElementById("firstNumber").value; + // Return the value of the input #secondNumber + let stringB = document.getElementById("secondNumber").value; + // Your code here + +}; diff --git a/.learn/resets/04-hide-on-click/index.html b/.learn/resets/04-hide-on-click/index.html new file mode 100644 index 0000000..4d9de3c --- /dev/null +++ b/.learn/resets/04-hide-on-click/index.html @@ -0,0 +1,22 @@ + + + + + + + 4Geeks Academy + + + + +
+ My first div +
+
+ My second div +
+ + + + + diff --git a/.learn/resets/04-hide-on-click/index.js b/.learn/resets/04-hide-on-click/index.js new file mode 100644 index 0000000..1a29c06 --- /dev/null +++ b/.learn/resets/04-hide-on-click/index.js @@ -0,0 +1,4 @@ +window.myEventListener = function myEventListener() { + // Your code here + +} diff --git a/.learn/resets/04-hide-on-click/styles.css b/.learn/resets/04-hide-on-click/styles.css new file mode 100644 index 0000000..f53502e --- /dev/null +++ b/.learn/resets/04-hide-on-click/styles.css @@ -0,0 +1,6 @@ +#firstDiv { + background: green; +} +#secondDiv { + background: yellow; +} diff --git a/.learn/resets/05-the-load-event/index.html b/.learn/resets/05-the-load-event/index.html new file mode 100644 index 0000000..609cdbc --- /dev/null +++ b/.learn/resets/05-the-load-event/index.html @@ -0,0 +1,13 @@ + + + + + + 4Geeks Academy + + + +

Hello! Please alert "Loading finished..." when this website finally loads.

+ + + diff --git a/.learn/resets/05-the-load-event/index.js b/.learn/resets/05-the-load-event/index.js new file mode 100644 index 0000000..d98d672 --- /dev/null +++ b/.learn/resets/05-the-load-event/index.js @@ -0,0 +1 @@ +// Your function goes here diff --git a/.learn/resets/06-add-listener-with-js/index.html b/.learn/resets/06-add-listener-with-js/index.html new file mode 100644 index 0000000..5d8c6c3 --- /dev/null +++ b/.learn/resets/06-add-listener-with-js/index.html @@ -0,0 +1,22 @@ + + + + + + 4Geeks Academy + + + + + + + + diff --git a/.learn/resets/06-add-listener-with-js/index.js b/.learn/resets/06-add-listener-with-js/index.js new file mode 100644 index 0000000..ecea46c --- /dev/null +++ b/.learn/resets/06-add-listener-with-js/index.js @@ -0,0 +1,7 @@ +window.onload = function myLoadFunction() { + alert("The website just finished loading!"); + // Some code here + +}; + +// The listener function here diff --git a/.learn/resets/07-count-on-click/index.html b/.learn/resets/07-count-on-click/index.html new file mode 100644 index 0000000..f8cb7ce --- /dev/null +++ b/.learn/resets/07-count-on-click/index.html @@ -0,0 +1,16 @@ + + + + + + + 4Geeks Academy + + + +

Loading...

+ + + + + diff --git a/.learn/resets/07-count-on-click/index.js b/.learn/resets/07-count-on-click/index.js new file mode 100644 index 0000000..2fceab4 --- /dev/null +++ b/.learn/resets/07-count-on-click/index.js @@ -0,0 +1,20 @@ +// This is a global variable +let counter = 0; + +window.onload = function loadFunction() +{ + // Here I set the screen to the initial value when the website is fully loaded + document.getElementById('screen').innerHTML = "The counter value is "+counter; +} + +// Called when the user clicks +window.increaseCounter = function increaseCounter() +{ + // Increase the global counter by one + counter++; + // Update the screen with the new value + document.getElementById('screen').innerHTML = "The counter value is "+counter; +} + +// Your code here + diff --git a/.learn/resets/07.1-change-turn-on-click/index.html b/.learn/resets/07.1-change-turn-on-click/index.html new file mode 100644 index 0000000..b891cd9 --- /dev/null +++ b/.learn/resets/07.1-change-turn-on-click/index.html @@ -0,0 +1,13 @@ + + + + + + 4Geeks Academy + + +

Loading...

+ + + + diff --git a/.learn/resets/07.1-change-turn-on-click/index.js b/.learn/resets/07.1-change-turn-on-click/index.js new file mode 100644 index 0000000..8b94cdd --- /dev/null +++ b/.learn/resets/07.1-change-turn-on-click/index.js @@ -0,0 +1,16 @@ +let currentUser = "Mario"; + +window.onload = function loadfn() { + document.getElementById("screen").innerHTML = "It's " + currentUser + "'s turn"; +} + +// Modify this function +window.turnChanger = function turnChanger() { + if (currentUser == "Mario") { + currentUser = "Juan"; + } else { + currentUser = "Mario"; + } + + document.getElementById("screen").innerHTML = "It's " + currentUser + "'s turn"; +} diff --git a/.learn/resets/08-event-target/index.html b/.learn/resets/08-event-target/index.html new file mode 100644 index 0000000..33d302f --- /dev/null +++ b/.learn/resets/08-event-target/index.html @@ -0,0 +1,16 @@ + + + + + + 4Geeks Academy + + +
+ + Click me + + +
+ + diff --git a/.learn/resets/08-event-target/index.js b/.learn/resets/08-event-target/index.js new file mode 100644 index 0000000..d44302c --- /dev/null +++ b/.learn/resets/08-event-target/index.js @@ -0,0 +1,7 @@ +window.onload = function loadFn() { + let containerElm = document.getElementById("container"); + containerElm.addEventListener("click", function(event) { + // Your code here + + }); +}; diff --git a/exercises/01-alert-on-click/index.html b/exercises/01-alert-on-click/index.html index c7ae1e7..ab16917 100644 --- a/exercises/01-alert-on-click/index.html +++ b/exercises/01-alert-on-click/index.html @@ -8,7 +8,9 @@ and - + + + diff --git a/exercises/02-on-click-Hello-World/index.html b/exercises/02-on-click-Hello-World/index.html index ca7ada9..e2943df 100644 --- a/exercises/02-on-click-Hello-World/index.html +++ b/exercises/02-on-click-Hello-World/index.html @@ -6,7 +6,7 @@ 4Geeks Academy - + diff --git a/exercises/02-on-click-Hello-World/index.js b/exercises/02-on-click-Hello-World/index.js index dabc5b9..81a661d 100644 --- a/exercises/02-on-click-Hello-World/index.js +++ b/exercises/02-on-click-Hello-World/index.js @@ -1 +1,4 @@ // Declare your function here +window.onclickHelloWorld = function(){ + alert("Hello World") +} diff --git a/exercises/03-sum-values/index.js b/exercises/03-sum-values/index.js index e3cc906..fec277a 100644 --- a/exercises/03-sum-values/index.js +++ b/exercises/03-sum-values/index.js @@ -5,5 +5,10 @@ window.calculateSumListener = function() { // Return the value of the input #secondNumber let stringB = document.getElementById("secondNumber").value; // Your code here + const result = parseInt(stringA) + parseInt(stringB); + + let resultImput = document.getElementById("resultNumber"); + resultImput.value = result; + console.log(`sumamos ${stringA} + ${stringB} = ${result} `); }; diff --git a/exercises/04-hide-on-click/index.html b/exercises/04-hide-on-click/index.html index 4d9de3c..886569f 100644 --- a/exercises/04-hide-on-click/index.html +++ b/exercises/04-hide-on-click/index.html @@ -1,22 +1,16 @@ + + + + 4Geeks Academy + + - - - - 4Geeks Academy - - - - -
- My first div -
-
- My second div -
- - - - + +
My first div
+
My second div
+ + + diff --git a/exercises/04-hide-on-click/index.js b/exercises/04-hide-on-click/index.js index 1a29c06..fb79f68 100644 --- a/exercises/04-hide-on-click/index.js +++ b/exercises/04-hide-on-click/index.js @@ -1,4 +1,5 @@ window.myEventListener = function myEventListener() { - // Your code here + const firstDiv = document.getElementById("firstDiv"); + firstDiv.style.display= "none"; } diff --git a/exercises/05-the-load-event/index.html b/exercises/05-the-load-event/index.html index 609cdbc..5341ecc 100644 --- a/exercises/05-the-load-event/index.html +++ b/exercises/05-the-load-event/index.html @@ -6,7 +6,7 @@ 4Geeks Academy - +

Hello! Please alert "Loading finished..." when this website finally loads.

diff --git a/exercises/05-the-load-event/index.js b/exercises/05-the-load-event/index.js index d98d672..192fc4b 100644 --- a/exercises/05-the-load-event/index.js +++ b/exercises/05-the-load-event/index.js @@ -1 +1,4 @@ // Your function goes here +window.myOnloadFunction = function(){ + alert("Loading finished..."); +} diff --git a/exercises/06-add-listener-with-js/index.html b/exercises/06-add-listener-with-js/index.html index 5d8c6c3..b48f118 100644 --- a/exercises/06-add-listener-with-js/index.html +++ b/exercises/06-add-listener-with-js/index.html @@ -5,10 +5,10 @@ 4Geeks Academy