Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="it">
- <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">
- <style>p{font-size: 18px;}</style>
- <title>Document</title>
- </head>
- <body>
- <p>
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptate eum blanditiis labore obcaecati nostrum, et minima quisquam ipsa sunt pariatur maiores nulla. Facere quos non, sequi mollitia voluptatem consectetur doloremque.
- Earum, aliquid? Necessitatibus odio nemo perferendis accusantium porro? Rerum debitis dignissimos tempora enim sint soluta. Aliquid obcaecati, quos sunt pariatur iure adipisci aut nobis? Voluptatem beatae optio dolore nemo minus.
- Vel repudiandae, nobis saepe corporis officia nemo impedit eligendi natus inventore ullam dolor dicta voluptate alias veritatis corrupti earum, dignissimos odio molestiae ad, quos similique quas tempore molestias? Illo, unde!
- Repellat animi voluptates voluptatem omnis dolore eligendi tenetur tempore? Facilis suscipit nulla pariatur in! Dolor, sed blanditiis. Assumenda optio consequatur debitis esse quaerat, eius ipsa accusantium nam cupiditate repudiandae aperiam.
- Odio incidunt corporis, culpa sapiente, magni rem velit quos corrupti laudantium repudiandae cumque dignissimos ducimus eum repellendus? Rerum ipsam officiis facere nulla magnam quidem? Mollitia quidem maxime excepturi rerum nulla.
- </p>
- <script>
- const colori = ["red", "yellow", "blue", "green", "purple"];
- const colorePartenza="black";
- let indiceColore = 0;
- document.querySelector("p").addEventListener("click", function () {
- this.style.color = colori[indiceColore];
- indiceColore++;
- if (indiceColore===colori.length) indiceColore=0;
- })
- </script>
- </body>
- </html>
- *********************************************************
- *********************************************************
- <!DOCTYPE html>
- <html lang="it">
- <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">
- <style>p{font-size: 18px;}</style>
- <title>Document</title>
- </head>
- <body>
- <img src="#" alt="immagine non specificata" ><br>
- <button id="1">1</button><button id="2">2</button><button id="3">3</button><button id="4">4</button>
- <script>
- const bottoni = document.querySelectorAll("button");
- for (let i=0; i<bottoni.length; i++)
- bottoni[i].addEventListener("click", function () {
- const id = this.textContent;
- document.querySelector("img").src="londra/londra"+id+".jpg";
- })
- </script>
- </body>
- </html>
- *********************************************************
- *********************************************************
- <!DOCTYPE html>
- <html lang="it">
- <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>Lampada</title>
- <style>
- .stelo,.base{
- background-color: #000;
- }
- .base{
- width: 160px;
- height: 20px;
- margin: 0 20px;
- }
- .stelo{
- width: 20px;
- height: 100px;
- margin-left: 90px ;
- }
- .lampada{
- width:100px;
- height:0;
- border-bottom: 200px solid black;
- border-left: 50px solid transparent;
- border-right: 50px solid transparent;
- }
- .interruttore{
- height: 100px;
- width: 50px;
- font-size: 50px;
- color: #FFF;
- background-color: #000;
- text-align: center;
- padding: 20px 0;
- box-sizing: border-box;
- margin-top: 50px;
- }
- .interruttore:hover{
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <div class="lampada"> </div>
- <div class="stelo"> </div>
- <div class="base"> </div>
- <div class="interruttore">0</div>
- <script>
- document.querySelector(".interruttore")
- .addEventListener("click", function () {
- const lampada = document.querySelector(".lampada");
- if (this.textContent==="0")
- {
- this.textContent="1";
- lampada.style.borderBottomColor = "yellow";
- }
- else
- {
- this.textContent="0";
- lampada.style.borderBottomColor = "black";
- }
- })
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement