请在这里查看示例 ☞ qrcode示例
1 兼容性ie8+(渲染到table中)
2 不支持中文
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<title>qrcode</title>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/jquery.qrcode.js"></script>
<script type="text/javascript" src="js/qrcode.js"></script>
<style>
* {margin: 0; padding: 0;}
div {display: inline-block; margin-right: 50px;}
</style>
</head>
<body>
<div class="table1"></div>
<div class="table2"></div>
</body>
<script>
;$(function() {
//不支持中文
$('.table1').qrcode({
render: 'table',
text: 'hello'
});
$('.table2').qrcode({
text: 'www.baidu.com',
width: 400, //设置宽度
height: 256, //设置高度
typeNumber: -1, //计算模式
background: "#C5C5C5",//背景颜色
foreground: "#7C4325" //前景颜色
});
console.log($('td').length);//441
});
</script>
</html>