
jQuery输入域名网址生成二维码代码是一款实用的域名文字内容生成二维码图片的网页特效。
js代码
<script src=\"js/modernizr-2.8.3.js\" type=\"text/javascript\"></script>
<script src=\"js/bootstrap.min.js\" type=\"text/javascript\"></script>
<script type=\"text/javascript\" src=\"js/qrcode.min.js\"></script>
<script type=\"text/javascript\">
//二维码内容
var txtContent = document.getElementById(\"txtContent\"), tips = $(\"#tips\");
// 设置 qrcode 参数
var qrcode = new QRCode(\'qrcode\', {
text: \'www.sucaihuo.com\',
width: 256,
height: 256,
colorDark: \'#000000\',
colorLight: \'#ffffff\',
correctLevel: QRCode.CorrectLevel.H
});
//生成二维码图像
function f_onCreateQrcode() {
if (!txtContent) {
return false;
} else {
if (!txtContent.value) {
tips.html(\"!请填写<strong>二维码内容</strong>再提交生成\");
} else {
// 使用 API
qrcode.clear();
tips.empty();
qrcode.makeCode(txtContent.value);
}
return false;
}
}
//清除二维码内容
function f_onClearQrcode() {
if (txtContent) {
txtContent.value = \"www.sucaihuo.com\";
// 使用 API
qrcode.clear();
qrcode.makeCode(\'请输入二维码内容再生成图像\');
}
}
</script>










暂无评论内容