`
默默的小熊
  • 浏览: 227342 次
社区版块
存档分类
最新评论

获取文件系统

 
阅读更多

<html>
  <head>
    <title>File System Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);
    }

    function onFileSystemSuccess(fileSystem) {
        document.getElementById("fileSystem").textContent="fileSystem:" + fileSystem.name;
        document.getElementById("fileSystemRoot").textContent="fileSystemRoot:" + fileSystem.root.name;
    }

    function fail(error) {
        console.log(error.code);
    }

    </script>
  </head>
  <body>
    <h1>Example</h1>
    <p>File System</p>
    <div id = "fileSystem"><div>
    <div id = "fileSystemRoot"><div>
  </body>
</html>
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics