|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html lang="en"> |
3 | | - |
4 | 3 | <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 | | - <link rel="stylesheet" href="style.css"> |
9 | | - <title>QR Code Generator</title> |
10 | | -</head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>QR Code Generator</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + display: flex; |
| 10 | + justify-content: center; |
| 11 | + align-items: center; |
| 12 | + height: 100vh; |
| 13 | + margin: 0; |
| 14 | + background-color: #f7f7f7; |
| 15 | + font-family: Arial, sans-serif; |
| 16 | + } |
| 17 | + |
| 18 | + .container { |
| 19 | + text-align: center; |
| 20 | + background: white; |
| 21 | + padding: 20px; |
| 22 | + border-radius: 8px; |
| 23 | + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
| 24 | + } |
| 25 | + |
| 26 | + h1 { |
| 27 | + margin-bottom: 20px; |
| 28 | + color: #333; |
| 29 | + } |
| 30 | + |
| 31 | + input { |
| 32 | + width: 80%; |
| 33 | + padding: 10px; |
| 34 | + border: 1px solid #ddd; |
| 35 | + border-radius: 5px; |
| 36 | + margin-bottom: 10px; |
| 37 | + } |
11 | 38 |
|
| 39 | + button { |
| 40 | + padding: 10px 20px; |
| 41 | + border: none; |
| 42 | + border-radius: 5px; |
| 43 | + background-color: #007bff; |
| 44 | + color: white; |
| 45 | + cursor: pointer; |
| 46 | + transition: background-color 0.3s; |
| 47 | + } |
| 48 | + |
| 49 | + button:hover { |
| 50 | + background-color: #0056b3; |
| 51 | + } |
| 52 | + |
| 53 | + #qrcode { |
| 54 | + margin-top: 20px; |
| 55 | + } |
| 56 | + </style> |
| 57 | +</head> |
12 | 58 | <body> |
13 | | - <h1>QR CODE GENERATOR</h1> |
14 | | - <div class="main"> |
15 | | - <input type="text" name="" id="" class="input" placeholder="Enter text here..."> |
16 | | - <button class="btn">Generate</button> <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTgdnbx19IIBKvSAwARaGMfbl06_CnXNcV63g&usqp=CAU" alt="qrcode" class="code"> |
17 | | - <p id="note">Made with ♥ by Khushi</p> |
18 | | - </div> |
19 | | - <div id="toast">Successfully Generated!!!</div> |
20 | | - <script src="script.js"></script> |
21 | | -</body> |
| 59 | + <div class="container"> |
| 60 | + <h1>QR Code Generator</h1> |
| 61 | + <input type="text" id="inputText" placeholder="Enter text or URL" /> |
| 62 | + <button id="generateButton">Generate QR Code</button> |
| 63 | + <div id="qrcode"></div> |
| 64 | + </div> |
| 65 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> |
| 66 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script> |
| 67 | + <script> |
| 68 | + $(document).ready(function() { |
| 69 | + $('#generateButton').on('click', function() { |
| 70 | + const inputText = $('#inputText').val(); |
| 71 | + $('#qrcode').empty(); // Clear previous QR code |
22 | 72 |
|
| 73 | + if (inputText) { |
| 74 | + $('#qrcode').qrcode({ |
| 75 | + text: inputText, |
| 76 | + width: 200, |
| 77 | + height: 200 |
| 78 | + }); |
| 79 | + } else { |
| 80 | + alert("Please enter a valid text or URL"); |
| 81 | + } |
| 82 | + }); |
| 83 | + }); |
| 84 | + </script> |
| 85 | +</body> |
23 | 86 | </html> |
0 commit comments