Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Przewodnik po kodzie:-->
- <!-- Wszystkie skrypty są opisane komentarzem przed, dla czytelności i ułatwienia Pani roboty ;)-->
- <!-- Aby aktywować Easter Egg z nasłuchiwaniem klawiszy należy wpisać "sus" na klawiaturze (uwaga, dźwięk po alerice :p )-->
- <!-- Nasłuchiwana jest również mysz nad napisem ford focus-->
- <!-- Formularz po wypełnieniu na górze storny wyświetla powitanie z imieniem, w zależności od wyboru płci zmienia kolor strony, oraz wyświetla napis spersonalizowany do marki którą wybrał użytkownik-->
- <!-- Jeżeli uzytkownik wybierze wiek poniżej 18 lat to zostanie przekierowany na google-->
- <!DOCTYPE html>
- <html lang="pl">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>SAMOCHODY</title>
- </head>
- <body>
- <style>
- p {
- font-weight: bold;
- }
- .list {
- list-style: disc;
- }
- .coloreq {
- color: magenta;
- }
- #container {
- display: none;
- }
- </style>
- <div id="container">
- <h2 id="welcome"></h2>
- <h3 id="info"></h3>
- <h1 id="title">SAMOCHODY</h1>
- <p id="szybkie">Szybkie</p>
- Mitsubishi<br>
- <span id="mondeo">ford mondeo</span>
- <p id="wolne">Wolne</p>
- Wszystko inne
- <p id="ladne">Ładne</p>
- Mitsubishi<br>
- ford mondeo
- <p id="brzydkie">Brzydkie</p>
- Wszystko inne
- <h3>Lista Mitsu</h3>
- <ul>
- <li class="list">Carisma</li>
- <li class="list">Galant</li>
- <li class="list">Colt</li>
- </ul>
- </div>
- <form id="form" onsubmit="return false">
- <p>Podaj swoje imie</p>
- <input id="name" type="text" value="imie">
- <p>Podaj swój wiek</p>
- <input id="age" type="number" value="18">
- <p>Wybierz ulubioną markę samochodu</p>
- <select name="cars" id="cars">
- <option value="Mitsubishi">Mitsubishi</option>
- <option value="Volvo">Volvo</option>
- <option value="Mercedes">Mercedes</option>
- <option value="Honda">Honda</option>
- </select>
- <p>Jakiej płci jesteś</p>
- <input type="radio" name="gender" value="male"> Mężczyzna
- <input type="radio" name="gender" value="female"> Kobieta
- <button onclick="wykonaj()">Prześlij</button>
- <p id="error"></p>
- </form>
- <script>
- // 1
- // Wyciąganie i console logi
- var ladne = document.getElementById("ladne");
- console.log(ladne);
- var lista = document.getElementsByClassName("list");
- console.log(lista);
- var p = document.querySelector("p");
- console.log(p);
- var collListy = document.getElementsByTagName("ul");
- console.log(collListy);
- var nodeListy = document.querySelectorAll("li.list");
- console.log(nodeListy);
- // Podmianka stylu
- document.getElementById("szybkie").style.color = "red";
- document.getElementById("szybkie").style.fontSize = "large";
- document.getElementById("szybkie").style.fontFamily = "Georgia";
- // Podmianka teskstu
- var el3 = document.querySelectorAll("li.list")[2];
- el3.innerHTML = "Sigma";
- var el2 = el3.previousSibling.previousSibling;
- el2.innerHTML = "Lancer";
- // Podmianka HTMLa
- document.getElementById("title").outerHTML = "<p id='title'><b>SAMOCHODY</b></p>";
- document.getElementById("title").classList.add("coloreq");
- // Dodanie nowych elementów listy
- var newEl = document.createElement('li').appendChild(document.createTextNode('Galant'));
- document.getElementsByTagName('ul')[0].appendChild(newEl);
- // Nasłuchiwanie myszy mouseover
- var mondeo = document.getElementById("mondeo");
- mondeo.addEventListener("mouseover", function () {
- document.body.style.backgroundImage = "url(https://halczynski.pl/ee/mondeo.jpg)";
- var mondeoSfx = new Audio('https://halczynski.pl/ee/mondeo.mp3');
- mondeoSfx.play();
- }, false);
- // Nasłuchiwanie klawiszy
- // lista zezwolonych klawiszy
- var allowedKeys = {
- 83: 's',
- 85: 'u'
- };
- // Kod do wpisania
- var susCode = ['s', 'u', 's'];
- var susCodePosition = 0;
- document.addEventListener('keydown', function (e) {
- var key = allowedKeys[e.keyCode];
- var requiredKey = susCode[susCodePosition];
- if (key == requiredKey) {
- susCodePosition++;
- if (susCodePosition == susCode.length) {
- activateSus();
- susCodePosition = 0;
- }
- } else {
- susCodePosition = 0;
- }
- });
- // Funkcja wykonująca Easter Egg
- function activateSus() {
- document.body.style.backgroundImage = "url('https://c.tenor.com/FMcazChVawwAAAAC/among-us-among.gif') ";
- document.body.style.backgroundRepeat = "no-repeat";
- document.body.style.backgroundSize = "cover";
- alert("big chungus among us");
- var audio = new Audio('https://halczynski.pl/ee/dram.mp3');
- audio.play();
- }
- // Form
- function wykonaj() {
- // Napis na początku
- document.getElementById('welcome').innerHTML = "Witaj " + document.getElementById("name").value;
- // Zmiana tła w zależności od wybranej płci
- var gender = document.getElementsByName('gender');
- for (let i = 0; i < gender.length; i++) {
- if (gender[i].checked) {
- if (gender[i].value === "male")
- document.body.style.backgroundColor = "lightblue";
- else
- document.body.style.backgroundColor = "pink";
- }
- }
- //Wybór marki auta
- var car = document.getElementById("cars").value;
- if (car === "Mitsubishi") {
- document.getElementById("info").innerHTML = "Widzę fan mitsu - dobry wybór :)"
- } else {
- document.getElementById("info").innerHTML = "Może to nie Mitsubishi, ale " + car + " też spoko :D";
- }
- // Weryfikacja wieku
- var age = document.getElementById("age");
- if (age.value >= 18) {
- alert("Gratulacje! Jesteś pełnoletni więc możesz widzieć tę stronę.");
- document.getElementById("container").style.display = "block";
- document.getElementById("form").style.display = "none";
- } else {
- window.location.replace("https://google.pl");
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment