-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (69 loc) · 2.1 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Code Qr Generateur</title>
<!-- sweet alert -->
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
/* .active{
transition: height 3s ease;
height: auto;
} */
</style>
</head>
<body>
<div class="box">
<h2>code qr Generateur</h2>
<input type="text" id="qr" class="inp" placeholder="Enter Your Link">
<div class="parent_class">
<input type="button" value="Generate" id="button">
</div>
<div class="qr-parent">
<div id="qrcode"></div>
</div>
<div class="" style="display:flex;justify-content:center">
<button id="button2" style="margin-bottom: 5px;">Download Qr code</button>
</div>
</div>
<script src="qrcode.min.js"></script>
<script>
var btn = document.getElementById("button");
let mainbox= document.querySelector(".box");
var qrcode=new QRCode(document.getElementById("qrcode"))
var qrdata=document.getElementById('qr');
function gg(){
var data=qrdata.value;
var coco=qrcode.makeCode(data);
}
function generate_qr(){
window.setTimeout("gg()",1200)
mainbox.classList.add("active");
}
//function qui check si le champ est vide
btn.onclick= (e)=>{
let input = document.querySelector(".inp");
let test=false;
if(input.value.length>=8){
test=true;
}
if(test===false){
e.preventDefault();
}else{
generate_qr()
}
}
let btn2 = document.querySelector("#button2");
btn2.onclick=()=>{
let img = document.images;
let link = document.createElement("a");
link.href=img[0].src;
link.download = 'image.png';
link.click()
}
</script>
</body>
</html>