jquery版 <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style> *{margin:0;padding:0} .absoluteCenter{ width:250px; height:250px;position:absolute; text-align: center; left:50%; top:50%; margin-left: -150px; margin-top: -150px; } </style> </head> <body> <div id="code" class="absoluteCenter"> <p style="margin-bottom: 30px; margin-top: -30px;">Share with friends</p> </div> </body> </html> <!--<script type="text/javascript" src="jquery.js"></script>--> <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script type="text/javascript" src="/template/default/code-css/jquery.qrcode.min.js"></script> <script> $("#code").qrcode({ render: "table", //table方式 width: 250, //宽度 height:250, //高度 text: "Remember to share with friends oh ??:" //任意内容 }); </script>
原文:https://www.cnblogs.com/dream-meng/p/12640235.html