话不多说,请看代码:
Take a Photodocument.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
}
//成功回调
function onPhotoSuccess(imageURI){
var myImage=document.getElementById('myImage');
myImage.style.display='block';
myImage.src=imageURI;
}
//失败回调
function onPhotoFail(message){
alert('Failed beacause:'+message);
}
//获取照片
function getPhoto(source){
navigator.camera.getPicture(onPhotoSuccess,onPhotoFail,{quality:50,sourceType:source});
}
From Photo Library
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持找一找教程网!