-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
66 lines (58 loc) · 1.77 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
55
56
57
58
59
60
61
62
63
64
65
66
<!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="styles.css" />
</head>
<body>
<div class="form">
<h1 class="title-color">QR Generator</h1>
<form>
<div class="input_wrapper">
<input
type="text"
id="website"
name="website"
placeholder="Enter Text or URL"
required
/>
</div>
<a href="#" class="text" type="button" onclick="generateQRCode()">
<span></span>
<span></span>
<span></span>
<span></span>
Generate
</a>
</form>
<div id="qrcode-container" style="display: none;">
<canvas id="qrcode" class="qrcode"></canvas>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
<script>
function generateQRCode() {
const inputField = document.getElementById("website");
const inputValue = inputField.value.trim();
const qrcodeContainer = document.getElementById("qrcode-container");
const canvas = document.getElementById("qrcode");
if (inputValue) {
// Generate QR Code
new QRious({
element: canvas,
value: inputValue,
size: 190,
});
// Show QR code container
qrcodeContainer.style.display = "block";
// Reset the input field
inputField.value = "";
} else {
alert("Please enter valid text or a URL.");
}
}
</script>
</body>
</html>