引用:javascript
<script src="js/jquery-1.9.1.js"></script> <script src="js/html5-qrcode.js"></script>
html5-qrcode.jshtml
jquery-1.9.1.jshtml5
<script type="text/javascript"> function readeQR() { $('#reader').html5_qrcode(function(data){ $('#read').html(data); alert('parsing success!') alert(data);//打印解析到的數據 $('#number').val(data); }, function(error){ $('#read_error').html(error); }, function(videoError){ $('#vid_error').html(videoError); } ); } </script> ………… ………… <div class="center" id="reader" style="width:300px;height:250px; background:red; position: absolute;display:none" > <video id="html5_qrcode_video" height="250px" width="300px"></video> <canvas id="qr-canvas" width="298px" height="248px" style="display:none;"></canvas> </div>