-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQR_code.html
More file actions
24 lines (24 loc) · 881 Bytes
/
QR_code.html
File metadata and controls
24 lines (24 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script>
<script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
</head>
<body>
<div id="qrcode"></div>
<a id="download" download="qrcode.jpg"></a>
<button id="save">save</button>
<script>
jQuery('#qrcode').qrcode({width: 500,height: 500,text: "http://cn.bing.com"});
// jQuery('#qrcode').qrcode({width: 500,height: 500,text: "http://www.baidu.com"});
$("#save").click(function(){
var canvas = $('#qrcode').find("canvas").get(0);
var url = canvas.toDataURL('image/jpeg');
$("#download").attr('href', url).get(0).click();
return false;
});
</script>
</body>
</html>