qr_mag.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
  3. <head>
  4. <title>Simple Magstripe QR test (prototype, not for general use)</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
  7. <script type="text/javascript" src="jquery.min.js"></script>
  8. <script type="text/javascript" src="qrcode.js"></script>
  9. </head>
  10. <body>
  11. <input id="text" type="text" value="test" style="width:80%" />
  12. <br />
  13. <div id='seed'></div>
  14. <div id='clear_text'></div>
  15. <div id="qrcode" style="width:100px; height:100px; margin-top:15px;"></div>
  16. <script type="text/javascript">
  17. var qrcode = new QRCode(document.getElementById("qrcode"), {
  18. width : 400,
  19. height : 400
  20. });
  21. function makeCode () {
  22. var elText = document.getElementById("text");
  23. if (!elText.value) {
  24. alert("Input a text");
  25. elText.focus();
  26. return;
  27. }
  28. qrcode.makeCode(elText.value);
  29. }
  30. makeCode();
  31. $("#text").
  32. on("blur", function () { makeCode(); }).
  33. on("keydown", function (e) { if (e.keyCode == 13) { makeCode(); } });
  34. </script>
  35. </body>
  36. </html>