<span style="white-space:pre"> </span>fileSystem.root.getDirectory("catchFile", {create:true,exclusive:false},function(){}, function(){alert('创建目录失败'); console.log("创建目录失败");});如果要创建多级目录,则如下所示:
<span style="white-space:pre"> </span>fileSystem.root.getDirectory("catchFile", {create:true,exclusive:false},function(){}, function(){alert('创建目录失败'); console.log("创建目录失败");}); <span style="white-space:pre"> </span><span style="font-family: Arial, Helvetica, sans-serif;">fileSystem.root.getDirectory("catchFile/2014", {create:true,exclusive:false},function(){}, function(){alert('创建目录失败'); console.log("创建目录失败");});</span>
<pre name="code" class="javascript">function(entry){ var smallImage = document.getElementById(id); smallImage.style.display = 'block'; smallImage.src = entry.fullPath; }<pre name="code" class="javascript"></pre>
<!DOCTYPE html> <html> <head> <title>获取手机信息-定位得到的具体地址名称</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" charset="utf-8" src="./js/frame/jquery-1.8.2.min.js"></script> <script type="text/javascript" charset="utf-8" src="./js/frame/cordova-2.6.0.js"></script> <script type="text/javascript" charset="utf-8"> // 等待加载PhoneGap document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap加载完毕 function onDeviceReady() { var element = document.getElementById('deviceProperties'); //获取 手机类型与系统版本 name:meizu_mx3 mione_plus //var modelVersion=device.name+","+device.platform+","+device.version; //var areas= element.innerHTML = 'Device Name: ' + device.name + '<br />' + 'Device PhoneGap: ' + device.phonegap + '<br />' + 'Device Platform: ' + device.platform + '<br />' + 'Device UUID: ' + device.uuid + '<br />' + 'Device Version: ' + device.version + '<br />'; navigator.geolocation.getCurrentPosition(onSuccess, onError); } function onSuccess(position) { var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' + 'Longitude: ' + position.coords.longitude + '<br />' + 'Altitude: ' + position.coords.altitude + '<br />' + 'Accuracy: ' + position.coords.accuracy + '<br />' + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' + 'Heading: ' + position.coords.heading + '<br />' + 'Speed: ' + position.coords.speed + '<br />' + 'Timestamp: ' + position.timestamp + '<br />'; getAddress(position.coords.latitude+","+position.coords.longitude); document.getElementById('coords_a').innerHTML= "http://maps.google.com/maps/api/geocode/json?latlng="+position.coords.longitude+","+position.coords.latitude+"&language=zh-CN&sensor=true"; //http://maps.google.com/maps/api/geocode/json?latlng=position.coords.longitude,position.coords.latitude&language=zh-CN&sensor=true } function onError(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); } //根据经纬度获取地址名称 function getAddress(location){ alert(location); $.ajax({ type:'get', url:'http://api.map.baidu.com/geocoder/v2/?ak=G1RbGxzkHMimFHc4SDy9GfK1&location='+location+'&output=json', dataType:'jsonp', async: false, error:function(){ alert("系统内部异常!"); }, success:function(json){ alert(json.result.addressComponent.city); $("#citys").html(json.result.addressComponent.city); } }); } </script> </head> <body> <ul> <li>只能在手机上看到结果</li> </ul> <p id="deviceProperties">Loading device properties...</p> <p id="geolocation">Finding geolocation...</p> <p id="coords_a">加载中...</p> <p id="citys">城市加载中...</p> </body> </html>
原文:http://blog.csdn.net/ybb350680013/article/details/30990041