webcodecamjs
Version:
bercode qrode decoder
33 lines • 1.29 kB
HTML
<html>
<head>
<meta charset="UTF-8">
<title>Demo</title>
</head>
<body>
<h3>Simple initalization with default settings</h3>
<h3>And decode uploaded image.</h3>
<hr>
<canvas with="320" height="240"></canvas>
<hr>
<input type="button" id="upload" value="upload" onclick="decodeLocalImage();">
<ul></ul>
<script type="text/javascript" src="js/filereader.js"></script>
<script type="text/javascript" src="js/qrcodelib.js"></script>
<script type="text/javascript" src="js/webcodecamjs.js"></script>
<script type="text/javascript">
var txt = "innerText" in HTMLElement.prototype ? "innerText" : "textContent";
var arg = {
resultFunction: function(result) {
var aChild = document.createElement('li');
aChild[txt] = result.format + ': ' + result.code;
document.querySelector('body').appendChild(aChild);
}
};
var decoder = new WebCodeCamJS("canvas").init(arg);
function decodeLocalImage(){
decoder.decodeLocalImage();
}
</script>
</body>
</html>