Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Text Repeater</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- background-color: #f9f9f9;
- text-align: center;
- padding: 20px;
- margin: 0;
- }
- .container {
- max-width: 100%;
- margin: 0 auto;
- background-color: #ffffff;
- padding: 20px;
- border-radius: 10px;
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
- }
- h1 {
- color: #007BFF;
- }
- input[type="text"], input[type="number"], button {
- width: 100%;
- padding: 10px;
- margin: 5px;
- border: 2px solid #007BFF;
- border-radius: 5px;
- font-size: 16px;
- background-color: #f1f1f1;
- outline: none;
- transition: background-color 0.3s ease;
- }
- input[type="text"]:focus, input[type="number"]:focus, button:focus {
- background-color: #e2e2e2;
- }
- button {
- cursor: pointer;
- color: white;
- background-color: #007BFF;
- transition: background-color 0.3s ease;
- }
- button:hover {
- background-color: #0056b3;
- }
- #outputText {
- margin-top: 15px;
- padding: 10px;
- border: 2px solid #007BFF;
- border-radius: 5px;
- font-size: 18px;
- background-color: #f1f1f1;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>Text Repeater</h1>
- <input type="text" id="textToRepeat" placeholder="Enter your text">
- <input type="number" id="repeatCount" placeholder="Repeat count">
- <button onclick="repeatText()">Repeat Text</button>
- <button onclick="copyText()">Copy Text</button>
- <div id="outputText"></div>
- </div>
- <script>
- function repeatText() {
- const textToRepeat = document.getElementById('textToRepeat').value;
- const repeatCount = document.getElementById('repeatCount').value;
- const outputText = document.getElementById('outputText');
- let repeatedText = '';
- for (let i = 0; i < repeatCount; i++) {
- repeatedText += textToRepeat + ' ';
- }
- outputText.textContent = repeatedText;
- }
- function copyText() {
- const outputText = document.getElementById('outputText');
- const textArea = document.createElement('textarea');
- textArea.value = outputText.textContent;
- document.body.appendChild(textArea);
- textArea.select();
- document.execCommand('copy');
- document.body.removeChild(textArea);
- alert('Text has been copied successfully!');
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment