-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
38 lines (30 loc) · 1.13 KB
/
test.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
<html>
<head>
<script language='javascript'>
window.onload = function() {
var div = document.getElementById('QRCode');
if(div != null) {
div.style.display = 'block';
} else {
div = document.createElement('div');
div.setAttribute('style', 'position:absolute;top:30%;left:40%;background:#ddf;width:300px;height:300px;z-index:10001;display:block;');
div.setAttribute('id', 'QRCode');
var img = document.createElement('img');
img.setAttribute('src', 'http://chart.apis.google.com/chart?cht=qr&chl=' + encodeURIComponent(location.href) + '&chs=250x250');
img.setAttribute('alt', 'QR Code of the page\'s link');
img.setAttribute('style', 'margin: 25px;margin-top:10px;');
var close = document.createElement('a');
close.textContent = '[x]';
close.setAttribute('style', 'color:blue;float:right;cursor:pointer;');
close.setAttribute('href', 'javascript:document.getElementById(\'QRCode\').style.display=\'none\';void(0);');
div.appendChild(close);
div.appendChild(img);
document.body.appendChild(div);
}
};
</script>
</head>
<body>
<h1>Tada!!</h1>
</body>
</html>