Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *** ESERCIZIO1.HTML ***
- <!DOCTYPE html>
- <html lang="en">
- <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>Document</title>
- </head>
- <body>
- <img id="foto" src="img/londra1.jpg" height="150px"> <br>
- <input id="numero" type="number" value="180"
- min="150" max="250">
- <button id="btn">APPLICA</button>
- <script>
- document.getElementById("btn")
- .addEventListener("click", function () {
- const valore = parseInt( document.getElementById("numero").value);
- if (valore>=150 && valore<=250)
- document.getElementById("foto").style.height=valore+"px"; //"180px"
- else
- {
- alert("Valore fuori intervallo!");
- document.getElementById("numero").value=180;
- }
- } )
- </script>
- </body>
- </html>
- *** ESERCIZIO2.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>
- .cuore {
- position:relative;
- width:50px;
- height:40px;
- -moz-transform:rotate(0);
- -webkit-transform:rotate(0);
- -ms-transform:rotate(0);
- -o-transform:rotate(0);
- transform:rotate(0);
- display: none;
- }
- .cuore:before {
- content:"";
- width:20px;
- height:30px;
- position:absolute;
- top:0;
- left:18px;
- background:red;
- border-radius:60px 60px 0 0;
- -moz-transform:rotate(-45deg);
- -webkit-transform:rotate(-45deg);
- -ms-transform:rotate(-45deg);
- -o-transform:rotate(-45deg);
- transform:rotate(-45deg);
- -moz-transform-origin:0 100%;
- -webkit-transform-origin:0 100%;
- -ms-transform-origin:0 100%;
- -o-transform-origin:0 100%;
- transform-origin:0 100%;
- }
- .cuore:after {
- content:"";
- width:20px;
- height:30px;
- position:absolute;
- left:0;
- top:0;
- background:red;
- border-radius:60px 60px 0 0;
- -moz-transform:rotate(45deg);
- -webkit-transform:rotate(45deg);
- -ms-transform:rotate(45deg);
- -o-transform:rotate(45deg);
- transform:rotate(45deg);
- -moz-transform-origin:100% 100%;
- -webkit-transform-origin:100% 100%;
- -ms-transform-origin:100% 100%;
- -o-transform-origin:100% 100%;
- transform-origin:100% 100%;
- }
- .iscrizione{
- background-color: lightgray;
- padding: 10px;
- font-weight: bold;
- color: black;
- border-radius: 5px;
- display: inline-block;
- cursor: pointer;
- }
- </style>
- <title>YouTube</title>
- </head>
- <body>
- <img src="img/londra1.jpg" alt=""><br>
- <div class="iscrizione">
- ISCRIVITI
- </div><br><br>
- <div class="cuore">
-
- </div>
- <script>
- const img = document.querySelector("img[src='img/londra1.jpg']");
- const div = document.querySelector(".cuore");
- img.addEventListener("mouseenter", function () {
- div.style.display = "block";
- });
- img.addEventListener("mouseleave", function () {
- div.style.display = "none";
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement