标签:rdo dev har use listener one data function idt
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Take a Photo</title> <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> <script type="text/javascript" charset="UTF-8"> document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { } //成功回调 function onPhotoSuccess(imageData){ var myImage=document.getElementById(‘myImage‘); myImage.style.display=‘block‘; myImage.src="data:image/jpeg;base64,"+imageData; } //失败回调 function onPhotoFail(message){ alert(‘Failed beacause:‘+message); } //拍照 function capturePhoto(){ navigator.camera.getPicture(onPhotoSuccess,onPhotoFail,{quality:50}); } </script> </head> <body> <button onclick="capturePhoto();"> Capture Photo</button><br> <img style="display:none;width: 60px;height:60px;" id="myImage" src=""/> </body> </html>
标签:rdo dev har use listener one data function idt
原文地址:http://www.cnblogs.com/ganchuanpu/p/6641868.html