Advertisement
MizunoBrasil

Gerador Loren ipsun dolor

Feb 11th, 2023 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="pt-br">
  3.   <head>
  4.     <meta charset="UTF-8" />
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6.     <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7.     <link
  8.       rel="stylesheet"
  9.       href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
  10.       integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
  11.       crossorigin="anonymous"
  12.     />
  13.     <style>
  14.       #text-container {
  15.         margin: 20px;
  16.         padding: 20px;
  17.         background-color: #f2f2f2;
  18.         border-radius: 10px;
  19.         text-align: center;
  20.         font-size: 1.2em;
  21.       }
  22.     </style>
  23.     <br><br>
  24.     <title>Gerador de Texto</title>
  25.   </head>
  26.   <body>
  27.     <div class="container">
  28.       <h1 class="text-center">Gerador de Texto</h1>
  29.       <div class="form-group">
  30.         <label for="num-paragraphs">Número de Parágrafos:</label>
  31.         <input
  32.           type="number"
  33.           class="form-control"
  34.           id="num-paragraphs"
  35.           value="1"
  36.         />
  37.       </div>
  38.       <button
  39.         type="button"
  40.         class="btn btn-primary mb-2"
  41.         id="generate-btn"
  42.         onclick="generateText()"
  43.       >
  44.         Gerar Texto
  45.       </button>
  46.       <button
  47.         type="button"
  48.         class="btn btn-secondary mb-2"
  49.         id="copy-btn"
  50.         onclick="copyText()"
  51.         disabled
  52.       >
  53.         Copiar para Área de Transferência
  54.       </button>
  55.       <div id="text-container"></div>
  56.     </div>
  57.     <script>
  58.       const textContainer = document.getElementById("text-container");
  59.       const numParagraphsInput = document.getElementById("num-paragraphs");
  60.       const generateBtn = document.getElementById("generate-btn");
  61.       const copyBtn = document.getElementById("copy-btn");
  62.       const loremIpsum =
  63.         "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla paratur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
  64.  
  65.   function generateText() {
  66.     textContainer.innerHTML = "";
  67.     let numParagraphs = numParagraphsInput.value;
  68.     for (let i = 0; i < numParagraphs; i++) {
  69.       let p = document.createElement("p");
  70.       p.innerHTML = loremIpsum;
  71.       textContainer.appendChild(p);
  72.     }
  73.     copyBtn.disabled = false;
  74.   }
  75.  
  76.   function copyText() {
  77.     let text = textContainer.innerText;
  78.     navigator.clipboard.writeText(text);
  79.     alert("Texto copiado com sucesso!");
  80.   }
  81. </script>
  82. </body>
  83. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement