Skip to content

Commit

Permalink
Merge pull request #801 from AshokKumar7070/patch-6
Browse files Browse the repository at this point in the history
Create qrcode.html
  • Loading branch information
Ayushparikh-code authored Oct 27, 2024
2 parents bb03f01 + 7225764 commit fa484aa
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions qrcode.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Generator</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 50px;
}
#qrcode {
margin-top: 20px;
}
input[type="text"] {
width: 80%;
padding: 10px;
font-size: 16px;
}
button {
padding: 10px 20px;
font-size: 16px;
margin-top: 20px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>QR Code Generator</h1>
<input type="text" id="textInput" placeholder="Enter text or URL" />
<br/>
<button onclick="generateQRCode()">Generate QR Code</button>
<div id="qrcode"></div>

<!-- Include the QRCode.js library -->
<script src="https://cdn.jsdelivr.net/npm/qrcodejs/qrcode.min.js"></script>

<script>
// Function to generate the QR code
function generateQRCode() {
// Get the input value
const text = document.getElementById('textInput').value;

// Clear any previous QR codes
document.getElementById('qrcode').innerHTML = '';

// Generate a new QR code
if (text) {
new QRCode(document.getElementById('qrcode'), text);
} else {
alert("Please enter some text or URL!");
}
}
</script>
</body>
</html>

0 comments on commit fa484aa

Please sign in to comment.