首页 > 代码库 > 使用phonegap从相册里面获取照片

使用phonegap从相册里面获取照片

<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>Take a Photo</title>

		<script type="text/javascript" charset="UTF-8" src="http://www.mamicode.com/cordova.js"></script>
		<script type="text/javascript" charset="UTF-8">
			document.addEventListener("deviceready", onDeviceReady, false);

			function onDeviceReady() {
			}
			
			//成功回调
			function onPhotoSuccess(imageURI){
				var myImage=document.getElementById(‘myImage‘);
				myImage.style.display=‘block‘;
				myImage.src=http://www.mamicode.com/imageURI;"getPhoto(Camera.PictureSourceType.PHOTOLIBRARY);"> From Photo Library</button><br>
		<img style="display:none;" id="myImage" src=""/>
	</body>

</html>

  

使用phonegap从相册里面获取照片