<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<title >javascript Two-dimensional code generation Library: Qrcode</title>
<meta http-equiv= "Content-type" content= "text/html; charset=UTF-8 "/>
<meta name=" viewport "content=" Width=device-width,initial-scale=1,user-scalable=no "/>
< Script type= "Text/javascript" src= "//cdn.bootcss.com/jquery/2.1.1/jquery.min.js" ></SCRIPT>
< Script type= "Text/javascript" src= "//static.runoob.com/assets/qrcode/qrcode.min.js" ></SCRIPT>
</ Head>
<body>
<input id= "text" type= "text" value= "https://www.runoob.com" style= "width:80%"/> <BR/>
<div id= "QRCode" style= "width:100px; height:100px; margin-top:15px;" ></div>
<script type= "Text/javascript" >
var qrcode = new QRCode (document.getElementById ("QRCode"), {
WIDTH:100,
height:100
});
function Makecode () {
var eltext = document.getElementById ("text");
if (!eltext.value) {
Alert ("Input a text");
Eltext.focus ();
Return
}
Qrcode.makecode (Eltext.value);
}
Makecode ();
$ ("#text").
On ("Blur", function () {
Makecode ();
}).
On ("KeyDown", function (e) {
if (E.keycode = = 13) {
Makecode ();
}
});
</script>
</body>
Javascript QR code generation Library: QRCode