Skip to content

Commit fa484aa

Browse files
Merge pull request #801 from AshokKumar7070/patch-6
Create qrcode.html
2 parents bb03f01 + 7225764 commit fa484aa

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

qrcode.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<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+
font-family: Arial, sans-serif;
10+
text-align: center;
11+
padding: 50px;
12+
}
13+
#qrcode {
14+
margin-top: 20px;
15+
}
16+
input[type="text"] {
17+
width: 80%;
18+
padding: 10px;
19+
font-size: 16px;
20+
}
21+
button {
22+
padding: 10px 20px;
23+
font-size: 16px;
24+
margin-top: 20px;
25+
cursor: pointer;
26+
}
27+
</style>
28+
</head>
29+
<body>
30+
<h1>QR Code Generator</h1>
31+
<input type="text" id="textInput" placeholder="Enter text or URL" />
32+
<br/>
33+
<button onclick="generateQRCode()">Generate QR Code</button>
34+
<div id="qrcode"></div>
35+
36+
<!-- Include the QRCode.js library -->
37+
<script src="https://cdn.jsdelivr.net/npm/qrcodejs/qrcode.min.js"></script>
38+
39+
<script>
40+
// Function to generate the QR code
41+
function generateQRCode() {
42+
// Get the input value
43+
const text = document.getElementById('textInput').value;
44+
45+
// Clear any previous QR codes
46+
document.getElementById('qrcode').innerHTML = '';
47+
48+
// Generate a new QR code
49+
if (text) {
50+
new QRCode(document.getElementById('qrcode'), text);
51+
} else {
52+
alert("Please enter some text or URL!");
53+
}
54+
}
55+
</script>
56+
</body>
57+
</html>

0 commit comments

Comments
 (0)