@bornkiller
2014-08-17T23:35:38.000000Z
字数 707
阅读 3202
javascript
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>normal love story</title>
<script src="libs/qrcode.js"></script>
<script>
(function(window) {
window.addEventListener('load',function(evt){
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
qrcode.makeCode('https://www.zybuluo.com/bornkiller/note/25567');
});
})(window)
</script>
</head>
<body>
<div id="qrcode"></div>
</body>
</html>
qrcode.makeCode
为生成二维码的内容,一般为URL地址。如果当中存在中文字符需要特殊处理。