101/100 punktów za screenshot z filterem

This commit is contained in:
Dark Steveneq
2026-02-02 17:53:59 +01:00
parent 3327976b86
commit 27b61c94f6
5 changed files with 137 additions and 3 deletions

42
assets/js/js-petle.js Normal file
View File

@@ -0,0 +1,42 @@
document.addEventListener("DOMContentLoaded", () => {
zad1();
zad7();
zad12();
zad17();
})
function zad1() {
const elem = document.getElementById("zad1")
for (let i = 0; 10 > i++; elem.innerText += i + "\n") {}
}
function zad6() {
}
function zad7() {
const elem = document.getElementById("zad7")
let cegly = 0;
for (let i = 10; 0 < i--; cegly += i * i) {}
elem.innerText += cegly + "\n"
}
function zad12() {
const start = parseInt(document.getElementById("zad12-start").value)
const n = parseInt(document.getElementById("zad12-n").value)
const elem = document.getElementById("zad12")
elem.innerText = ""
for (let i = 0; n > i; i++) {
elem.innerHTML += `${(start + i) * (start + i)} `
}
}
function zad17() {
const elem = document.getElementById("zad17")
for (let i = 0; 5 > i++;) {
for (let j = 0; i > j; j++) {
elem.innerText += (i + j) % 2 == 0 ? "0" : "1"
}
elem.innerText += "\n"
}
}

View File

@@ -1,5 +1,6 @@
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
zad4SprawdzParzystosc(); zad4SprawdzParzystosc();
zad6Sprawdz();
zad7Przesun(); zad7Przesun();
zad8Przelicz(); zad8Przelicz();
}) })
@@ -8,6 +9,19 @@ function zad4SprawdzParzystosc() {
document.getElementById("zad4-wynik").innerText = document.getElementById("zad4-liczba").valueAsNumber % 2 == 1 ? "Nieparzysta" : "Parzysta"; document.getElementById("zad4-wynik").innerText = document.getElementById("zad4-liczba").valueAsNumber % 2 == 1 ? "Nieparzysta" : "Parzysta";
} }
function zad6Sprawdz() {
document.getElementById("zad6-wynik").innerText = () => {
switch (nr = document.getElementById("zad4-liczba").valueAsNumber) {
case (nr > 0):
return "Dodatnia"
case 0:
return "Zero"
case (nr < 0):
return "Ujemna"
}
}
}
function zad7Przesun() { function zad7Przesun() {
const wiek = Number(document.getElementById("zad7-slider").value); const wiek = Number(document.getElementById("zad7-slider").value);
document.getElementById("zad7-wiek").innerHTML = "Wiek: " + (wiek >= 18 ? "18+" : wiek); document.getElementById("zad7-wiek").innerHTML = "Wiek: " + (wiek >= 18 ? "18+" : wiek);

View File

@@ -1,8 +1,8 @@
const nawigacjaLinki = [ const nawigacjaLinki = [
{ nazwa: "Tabele", link: "/tabele.html" }, { nazwa: "Tabele", link: "/tabele.html" },
{ nazwa: "Grafika", link: "/grafika.html" }, { nazwa: "Grafika", link: "/grafika.html" },
{ nazwa: "JS. Funkcje", link: "/js-funkcje.html" }, { nazwa: "JS. Zad. Warunkowe", link: "/js-warunkowe.html" },
{ nazwa: "JS. Zdarzenia", link: "/js-zdarzenia.html" }, { nazwa: "JS. Pętle", link: "/js-petle.html" },
]; ];
const stopkaLinki = [ const stopkaLinki = [
[ [
@@ -18,6 +18,7 @@ const stopkaLinki = [
{ nazwa: "JS. Zad. Warunkowe", link: "/js-warunkowe.html" }, { nazwa: "JS. Zad. Warunkowe", link: "/js-warunkowe.html" },
{ nazwa: "JS. Funkcje", link: "/js-funkcje.html" }, { nazwa: "JS. Funkcje", link: "/js-funkcje.html" },
{ nazwa: "JS. Zdarzenia", link: "/js-zdarzenia.html" }, { nazwa: "JS. Zdarzenia", link: "/js-zdarzenia.html" },
{ nazwa: "JS. Pętle", link: "/js-petle.html" },
], ],
[ [
"HTML", "HTML",

68
js-petle.html Normal file
View File

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS Pętle. - MaszToZadanieDomowe.com</title>
<link href="/favicon.ico" rel="favicon">
<link href="/assets/css/main.css" rel="stylesheet">
<script data-goatcounter="https://zeszyt.nonamesoft.xyz/count" async src="/assets/js/count.js"></script>
<script type="module" src="/assets/js/index.js"></script>
<script src="/assets/js/akordeon.js"></script>
<script src="/assets/js/js-wspolne.js"></script>
<script src="/assets/js/js-petle.js"></script>
</head>
<body>
<header-comp></header-comp>
<main>
<h2>JavaScript Pętle</h2>
<hr>
<ol>
<li>
<h4>Całkowite</h4>
<hr>
<p id="zad1"></p>
</li>
<br>
<li value="5">
<h4>Pensje</h4>
<hr>
</li>
<br>
<li>
<h4>Nie wiem</h4>
<hr>
<p id="zad6"></p>
</li>
<br>
<li>
<h4>Piramida 10x10</h4>
<hr>
<p id="zad7"></p>
</li>
<br>
<li value="12">
<h4>kwadratowanie</h4>
<hr>
<label for="zad12-start">Liczba początkowa</label>
<input id="zad12-start" oninput="zad12()">
<label for="zad12-n">N</label>
<input id="zad12-n" oninput="zad12()">
<p id="zad12"></p>
</li>
<br>
<li value="15">
<h4>Wizualizacja piramidy</h4>
<hr>
</li>
<br>
<li value="17">
<h4>trójkąt zera i jedynki</h4>
<hr>
<p id="zad17"></p>
</li>
</ol>
</main>
<footer-comp></footer-comp>
</body>
</html>

View File

@@ -45,7 +45,16 @@
<h4 id="zad4-wynik">Parzysta</h4> <h4 id="zad4-wynik">Parzysta</h4>
</li> </li>
<br> <br>
<li value="7"> <li value="6">
<h4>Zakres</h4>
<hr>
<label for="zad6-liczba">Liczba</label>
<input id="zad6-liczba" type="number" value="2" oninput="zad6Sprawdz()">
<hr>
<h4 id="zad4-wynik">Dodatnia</h4>
</li>
<br>
<li>
<h4>Klasyfikacja wieku</h4> <h4>Klasyfikacja wieku</h4>
<hr> <hr>
<button onclick="document.getElementById('nieaktywne').id='aktywne'">Otwórz klasyfikacje wieku</button> <button onclick="document.getElementById('nieaktywne').id='aktywne'">Otwórz klasyfikacje wieku</button>