<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0" />
<title>Sample</title>
<script src="cordova-2.7.0.js" type="text/javascript"></script>
<script type="text/javascript">
if (!navigator.userAgent.toLowerCase().match('chrome')) {
document.write("<script src='phonegap.js'><\/script>");
}
</script>
</head>
<body onload="onLoaded()">
<div class="info" style="font-size:12px">CCN TEST</div>
<script>
function onLoaded() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, onError);
}
function onSuccess(fileSystem){
fileSystem.root.getDirectory("app_newDir",{create:true, exclusive:false}, onCreateSuccess, onCreateError);
}
function onError(err){
alert(err.code);
}
function onCreateSuccess(parent){
alert('成功建立目錄,路徑是:'+parent.fullPath);
}
function onCreateError(err){
alert('沒有成功建立目錄:'+err.code);
}
</script>
</body>
</html>
- Jun 06 Fri 2014 15:54
[PhoneGap] 建立資料夾
close
全站熱搜
留言列表