-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
34 lines (32 loc) · 1.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Generator using HTML, CSS, and JavaScript</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<p>Enter Text Or URL</p>
<input type="text" placeholder="Text or URL" id="qrText">
<div class="imgbox">
<img src="" id="qrImg">
</div>
<button onclick="GenerateQR()">Generate QR Code</button>
</div>
<script>
let imgbox = document.querySelector(".imgbox");
let qrImg = document.getElementById("qrImg");
let qrText = document.getElementById("qrText");
function GenerateQR() {
if (qrText.value.length > 0) {
qrImg.src = "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" + qrText.value;
imgbox.style.display = "block"; // Show the image box
} else {
imgbox.style.display = "none"; // Hide the image box if there's no value
}
};
</script>
</body>
</html>