-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (45 loc) · 1.37 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!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>
<link rel="stylesheet" href="style/style.css" />
<!-- <script src="script/script.js"></script> -->
</head>
<body>
<div class="container">
<p>Enter your text or URL</p>
<input type="text" placeholder="Enter your text or URL" id="qrText" />
<div id="imgBox">
<img src="" id="qrImage" />
</div>
<button onclick="generateQR()">Generate QR Code</button>
</div>
<script src="script/script.js"></script>
<!-- or -->
<!-- <script>
let imgBox = document.getElementById("imgBox");
let qrImage = document.getElementById("qrImage");
let lqrText = document.getElementById("qrText");
function generateQR() {
if (qrText.value.length > 0) {
qrImage.src =
"https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=" +
qrText.value;
imgBox.classList.add("show-img");
}
// else{
// alert("Please enter a text or URL");
// }
// or
else {
qrText.classList.add("error");
setTimeout(() => {
qrText.classList.remove("error");
}, 1000);
}
}
</script> -->
</body>
</html>