javascript怎么将url生成二维码
2个回答
展开全部
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<script src="js/qrcode.js"></script>
<style>
#qrcode{
/*text-align: center;*/
/*display: table-cell;*/
/*width: 96px;*/
/*height: 96px;*/
/*vertical-align:middle;*/
/*position: relative;*/
}
</style>
</head>
<body>
<div id="qrcode">
</div>
<input type="text" id="getval"/> <button id="send">点击更换验证码</button>
<script>
window.onload =function(){
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 96,//设置宽高
height : 96
});
qrcode.makeCode("http://www.baidu.com");
document.getElementById("send").onclick =function(){
qrcode.makeCode(document.getElementById("getval").value);
}
}
</script>
</body>
</html>
网上找的应该有用 以后多度娘
<html>
<head>
<title></title>
<meta charset="utf-8"/>
<script src="js/qrcode.js"></script>
<style>
#qrcode{
/*text-align: center;*/
/*display: table-cell;*/
/*width: 96px;*/
/*height: 96px;*/
/*vertical-align:middle;*/
/*position: relative;*/
}
</style>
</head>
<body>
<div id="qrcode">
</div>
<input type="text" id="getval"/> <button id="send">点击更换验证码</button>
<script>
window.onload =function(){
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 96,//设置宽高
height : 96
});
qrcode.makeCode("http://www.baidu.com");
document.getElementById("send").onclick =function(){
qrcode.makeCode(document.getElementById("getval").value);
}
}
</script>
</body>
</html>
网上找的应该有用 以后多度娘
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2016-10-24 · 百度知道合伙人官方认证企业
兄弟连教育
兄弟连教育成立于2006年,11年来专注IT职业教育,是国内专业的IT技术培训学校。2016年成功挂牌新三板(股票代码:839467)市值过亿。开设专注程序员培训专注php、Java、UI、云计算、Python、HTML5、
向TA提问
关注
展开全部
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new MultiFormatWriter()
.encode(url, BarcodeFormat.QR_CODE, 300, 300, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", stream);
@RequestMapping("/qr-code")
public void placeQrOrder(HttpServletResponse resp) {
resp.setHeader("Cache-Control", "no-store");
resp.setHeader("Pragma", "no-cache");
resp.setDateHeader("Expires", 0);
resp.setContentType("image/png");
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new MultiFormatWriter()
.encode("https://www.google.com", BarcodeFormat.QR_CODE, 300, 300, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", resp.getOutputStream());
}
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new MultiFormatWriter()
.encode(url, BarcodeFormat.QR_CODE, 300, 300, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", stream);
@RequestMapping("/qr-code")
public void placeQrOrder(HttpServletResponse resp) {
resp.setHeader("Cache-Control", "no-store");
resp.setHeader("Pragma", "no-cache");
resp.setDateHeader("Expires", 0);
resp.setContentType("image/png");
Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new MultiFormatWriter()
.encode("https://www.google.com", BarcodeFormat.QR_CODE, 300, 300, hints);
MatrixToImageWriter.writeToStream(bitMatrix, "png", resp.getOutputStream());
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询