Advertisement
fcamuso

Corso recupero Javascript - video 9

Nov 21st, 2022
1,013
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <!DOCTYPE html>
  3. <html lang="it">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8.     <style>
  9.         .cuore {
  10.             position:relative;
  11.             width:50px;
  12.             height:40px;
  13.             -moz-transform:rotate(0);
  14.             -webkit-transform:rotate(0);
  15.             -ms-transform:rotate(0);
  16.             -o-transform:rotate(0);
  17.             transform:rotate(0);
  18.             display: none;
  19.         }
  20.         .cuore:before {
  21.             content:"";
  22.             width:20px;
  23.             height:30px;
  24.             position:absolute;
  25.             top:0;
  26.             left:18px;
  27.             background:red;
  28.             border-radius:60px 60px 0 0;
  29.             -moz-transform:rotate(-45deg);
  30.             -webkit-transform:rotate(-45deg);
  31.             -ms-transform:rotate(-45deg);
  32.             -o-transform:rotate(-45deg);
  33.             transform:rotate(-45deg);
  34.             -moz-transform-origin:0 100%;
  35.             -webkit-transform-origin:0 100%;
  36.             -ms-transform-origin:0 100%;
  37.             -o-transform-origin:0 100%;
  38.             transform-origin:0 100%;
  39.         }
  40.         .cuore:after {
  41.             content:"";
  42.             width:20px;
  43.             height:30px;
  44.             position:absolute;
  45.    
  46.             left:0;
  47.             top:0;
  48.             background:red;
  49.             border-radius:60px 60px 0 0;
  50.             -moz-transform:rotate(45deg);
  51.             -webkit-transform:rotate(45deg);
  52.             -ms-transform:rotate(45deg);
  53.             -o-transform:rotate(45deg);
  54.             transform:rotate(45deg);
  55.             -moz-transform-origin:100% 100%;
  56.             -webkit-transform-origin:100% 100%;
  57.             -ms-transform-origin:100% 100%;
  58.             -o-transform-origin:100% 100%;
  59.             transform-origin:100% 100%;
  60.         }
  61.         .iscrizione{
  62.             background-color: lightgray;
  63.             padding: 10px;
  64.             font-weight: bold;
  65.             color: black;
  66.             border-radius: 5px;
  67.             display: inline-block;
  68.             cursor: pointer;
  69.         }
  70.     </style>
  71.     <title>YouTube</title>
  72. </head>
  73. <body>
  74.     <img src="img/londra1.jpg" alt=""><br>
  75.  
  76.  
  77.     <script>
  78.     const coloreBase ="black";
  79.     const colori = ["red", "orange", "blue", "green", "purple", "yellow"];
  80.  
  81.     const img = document.querySelector("img");
  82.     img.style.borderColor=coloreBase;
  83.     img.style.borderStyle="solid";
  84.     img.style.borderWidth="3px";
  85.  
  86.     let cont=0;
  87.  
  88.     img.addEventListener("mouseenter", function () {
  89.       this.style.borderColor = colori[cont];
  90.       cont++;
  91.       if (cont===6) cont=0;
  92.     });
  93.  
  94.     img.addEventListener("mouseleave", function () {
  95.       this.style.borderColor = coloreBase;
  96.     })
  97.  
  98.   </script>
  99. </body>
  100. </html>
  101.  
  102. *********************************************************************************************************
  103. *********************************************************************************************************
  104.  
  105. <!DOCTYPE html>
  106. <html lang="it">
  107. <head>
  108.     <meta charset="UTF-8">
  109.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  110.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  111.     <style>p{font-size: 18px;}</style>
  112.     <title>Document</title>
  113. </head>
  114. <body>
  115.     <p>
  116.         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.
  117.         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.
  118.         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!
  119.         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.
  120.         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.
  121.     </p>
  122.  
  123.     <input type="number" id="dimensione" min="15" max="25" value="18"><br>
  124.     <button>Applica</button>
  125.  
  126.     <script>
  127.         document.querySelector("button").addEventListener("click", function () {
  128.            const nuovaDimensione = parseInt(document.getElementById("dimensione").value);
  129.            const p = document.querySelector("p");
  130.  
  131.            if (isNaN(nuovaDimensione))
  132.               alert("non hai inserito un numero");
  133.            else
  134.              if (nuovaDimensione<15 || nuovaDimensione>25)
  135.                 alert("Numero fuori intervallo consentito");
  136.              else
  137.                p.style.fontSize = nuovaDimensione+"px";
  138.  
  139.            p.value="18";
  140.         })
  141.     </script>
  142.    
  143.  
  144. </body>
  145. </html>
  146.  
  147. *********************************************************************************************************
  148. *********************************************************************************************************
  149.  
  150.  
  151. <!DOCTYPE html>
  152. <html lang="it">
  153. <head>
  154.     <meta charset="UTF-8">
  155.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  156.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  157.     <title>Lampada</title>
  158.     <style>
  159.         .stelo,.base{
  160.             background-color: #000;
  161.         }
  162.         .base{
  163.             width: 160px;
  164.             height: 20px;
  165.             margin: 0 20px;
  166.         }
  167.         .stelo{
  168.             width: 20px;
  169.             height: 100px;
  170.             margin-left: 90px ;
  171.         }
  172.         .lampada{
  173.             width:100px;
  174.             height:0;
  175.             border-bottom: 200px solid black;
  176.             border-left: 50px solid transparent;
  177.             border-right: 50px solid transparent;
  178.         }
  179.         .interruttore{
  180.             height: 100px;
  181.             width: 50px;
  182.             font-size: 50px;
  183.             color: #FFF;
  184.             background-color: #000;
  185.             text-align: center;
  186.             padding: 20px 0;
  187.             box-sizing: border-box;
  188.             margin-top: 50px;
  189.         }
  190.         .interruttore:hover{
  191.             cursor: pointer;
  192.         }
  193.     </style>
  194. </head>
  195. <body>
  196.     <div class="lampada">&nbsp;</div>
  197.     <div class="stelo">&nbsp;</div>
  198.     <div class="base">&nbsp;</div>
  199.     <div class="interruttore">0</div>
  200. </body>
  201. </html>
  202.  
  203.  
  204.  
  205.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement