(首先,如果我的英语不好,请原谅......) 我按照TMT条码扫描器教程,它工作正常,但后来我尝试在条码示例中加入一些JQuery(按照“使用PhoneGap媒体API和jQuery移动UI框架”教程)...现在条形码不再打开了
这是index.html:
<body>
<!-- a href="#" class="btn" onclick="scanCode();">Scan Code</a>-->
<div data-role="page" data-theme="a" id="page-home">
<div data-role="header" data-nobackbtn="true" data-theme="e">
<h1>Barcode</h1>
</div> <!-- /header -->
<div data-role="content" id="content-manual" data-theme="a">
<div data-role="button" id="playaudio" data-theme="e">Play</div>
</div> <!-- /content-manual -->
</div> <!-- /page -->
</body>
这是main.js:
$('#page-home').live('pageinit',function(){
$("#playaudio").live('tap', function() {
// Note: two ways to access media file: web and local file
var scanCode = function() {
window.plugins.barcodeScanner.scan(
function(result) {
alert("Scanned Code: " + result.text
+ ". Format: " + result.format
+ ". Cancelled: " + result.cancelled);
}, function(error) {
alert("Scan failed: " + error);
});
}
});
})
你可以帮我吗?