-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbarcode.html
More file actions
62 lines (53 loc) · 1.51 KB
/
barcode.html
File metadata and controls
62 lines (53 loc) · 1.51 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Barcode Generator</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jhildenbiddle/sass-helpers@1.1.1/dist/sass-helpers.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.0/dist/JsBarcode.all.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 20px;
}
#barcode-input {
width: 300px;
padding: 10px;
font-size: 16px;
}
#generate-button {
padding: 10px;
font-size: 16px;
cursor: pointer;
}
#barcode-display {
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Barcode Generator</h1>
<input type="text" id="barcode-input" placeholder="Enter text for barcode">
<button id="generate-button" onclick="generateBarcode()">Generate Barcode</button>
<div id="barcode-display"></div>
<script>
function generateBarcode() {
var inputText = document.getElementById("barcode-input").value;
var barcodeDisplay = document.getElementById("barcode-display");
if (inputText.trim() !== "") {
JsBarcode("#barcode-display", inputText, {
format: "CODE128",
displayValue: true,
fontSize: 16,
width: 2,
height: 80
});
} else {
barcodeDisplay.innerHTML = "Please enter text for the barcode.";
}
}
</script>
</body>
</html>