<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>生成二维码</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<style type="text/css">
body{margin: 0;}
.module-content{
min-width: 320px;
max-width: 1000px;
width: 100%;
color: #000;
margin: 0 auto;
padding-left: 10px;
box-sizing: border-box;
}
.module-head{
text-align: center;
font-weight: 500;
margin: 0;
font-size: 30px;
height: 100px;
line-height: 100px;
color: #000;
}
.box h3{
font-weight: 300;
margin: 0;
font-size: 20px;
height: 60px;
line-height: 60px;
color: #000;
}
#text{
outline: none;
width: 200px;
height: 30px;
line-height: 30px;
font-size: 14px;
padding-left: 10px;
}
</style>
</head>
<body>
<div class="module-content">
<!--生成二维码-->
<h1 class="module-head">生成二维码</h1>
<div class="box">
<h3>填写生成二维码的内容</h3>
<input id="text" type="text" value="http://m.tyfo.com"/>
</div>
<div class="box">
<h3>生成的二维码</h3>
<div id="qrcode"></div>
</div>
</div>
<script src="QRCode.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
(function(){
let elText = document.getElementById("text");
let qrcode = new QRCode(document.getElementById("qrcode"), {
width : 120,
height : 120
});
function makeCode(){
if (!elText.value) {
elText.onfocus();
return;
}
qrcode.makeCode(elText.value);
}
makeCode();
elText.addEventListener('blur',function(){
makeCode();
},false);
elText.addEventListener('keydown',function(e){
if(e.keyCode === 13)makeCode();
},false);
}())
</script>
</body>
</html>
原生js ---- 二维码生成器demo
需积分: 1 65 浏览量
2017-09-19
10:35:16
上传
评论 1
收藏 8KB RAR 举报
Rattenking
- 粉丝: 3w+
- 资源: 38
最新资源
- [聊天留言]Ajax PHP文本留言本_xingbook.rar
- ASP.NET某店积分更新记录管理(源代码+论文).rar
- 友邻b2b电子商务 v2.3 简体GBK_gbk_电子商务网站开发模板(使用说明+源代码+html).zip
- JSP企业人事管理系统设计(源代码+论文).rar
- VFP现代物流企业管理系统(源代码+论文).rar
- [图片动画]iFoto v1.0_ifoto-1.0.1.rar
- ssm+vue的物资物流系统的设计与实现(有报告) Javaee项目,ssm vue前后端分离项目
- 521yy 网站Whois查询 php版 1.0_whois_工具查询网站开发模板(使用说明+PHP源代码+html).zip
- vb药品库房管理系统设计(源代码+可执行程序+论文+开题报告+外文翻译+答辩ppt).rar
- 按键 12864显示_单片机C语言实例(纯C语言源代码).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈