-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqrcode.html
59 lines (53 loc) · 2.06 KB
/
qrcode.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
<!DOCTYPE html>
<html lang="en">
<head>
<base target="_top">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://code.jquery.com/jquery-3.6.4.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" />
<style>
@import url('https://fonts.googleapis.com/css2?family=Sarabun&display=swap');
body {
font-family: 'Sarabun', sans-serif;
font-size: .875rem;
}
a {
color: #cc2900;
text-decoration: none;
}
</style>
</head>
<body>
<div class="container mb-5">
<div class="col-md-6 mx-auto">
<div class="h5 bg-success text-white p-2 mb-2"><i class="fa-solid fa-align-justify"></i> Form Generator QRCODE</div>
<form id="myForm" onsubmit="submitForm(this)">
<label><i class="fa-brands fa-chrome"></i> กรอก link ที่ต้องการสร้าง QRCODE</label>
<input type='url' class="form-control mb-2" id='chl' placeholder="ตัวอย่าง https://pao-sisaket.go.th" pattern="https://.*" required>
<button type="submit" class="btn btn-success w-100" id="btn1" ><i class="fa-solid fa-qrcode"></i> สร้าง QRCODE</button>
</form>
<div class="text-center">
<div id="qrcode"></div>
</div>
</div>
</div>
<footer class="text-center fixed-bottom mb-4">
<div class="copyright"></div>
</footer>
<script>
$(document).ready(function() {
setFooter()
});
function submitForm(obj){
event.preventDefault()
var chs = $('#chs').val()
var chl = $('#chl').val()
var qr = "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl="+chl+""
$("#qrcode").html(`<a href="${qr}" target="_blank"><img src="${qr}" width="60%"></a>`)
$('#myForm')[0].reset()
}
</script>
<!--<script src="https://cdn.jsdelivr.net/gh/examblog/web/js/FtExamblog.js"></script>-->
</body>
</html>