Skip to content

Commit 565f7f6

Browse files
authored
Create qrcode_gen.html
We'll use the free QR Code Generator API from goqr.me for this. The API allows us to generate QR codes by sending a request to their server with the data.
1 parent ec021c9 commit 565f7f6

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

qrcode_gen.html

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
display: flex;
11+
flex-direction: column;
12+
align-items: center;
13+
justify-content: center;
14+
height: 100vh;
15+
margin: 0;
16+
background-color: #f7f7f7;
17+
}
18+
19+
.container {
20+
background-color: #fff;
21+
padding: 20px;
22+
border-radius: 8px;
23+
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
24+
text-align: center;
25+
}
26+
27+
input {
28+
padding: 10px;
29+
width: 100%;
30+
margin-bottom: 20px;
31+
border-radius: 5px;
32+
border: 1px solid #ccc;
33+
box-sizing: border-box;
34+
}
35+
36+
button {
37+
padding: 10px 15px;
38+
background-color: #007BFF;
39+
color: white;
40+
border: none;
41+
border-radius: 4px;
42+
cursor: pointer;
43+
}
44+
45+
button:hover {
46+
background-color: #0056b3;
47+
}
48+
49+
img {
50+
margin-top: 20px;
51+
max-width: 200px;
52+
height: auto;
53+
}
54+
</style>
55+
</head>
56+
<body>
57+
58+
<div class="container">
59+
<h2>QR Code Generator</h2>
60+
<input type="text" id="text" placeholder="Enter text or URL" />
61+
<button onclick="generateQRCode()">Generate QR Code</button>
62+
63+
<div id="qrCode">
64+
<!-- QR code will appear here -->
65+
</div>
66+
</div>
67+
68+
<script>
69+
function generateQRCode() {
70+
// Get the value from the input field
71+
var text = document.getElementById("text").value;
72+
73+
// API endpoint for QR code generation
74+
var apiUrl = "https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=" + encodeURIComponent(text);
75+
76+
// Display the QR code in an img tag
77+
document.getElementById("qrCode").innerHTML = "<img src='" + apiUrl + "' alt='QR Code' />";
78+
}
79+
</script>
80+
81+
</body>
82+
</html>

0 commit comments

Comments
 (0)