• __HTML_5读取文件API


    //HTML5 __FileSystemApi

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    </head>
    <body>
    <style>
      .thumb {
        height: 75px;
        border: 1px solid #000;
        margin: 10px 5px 0 0;
      }
    </style>
    
    <input type="file" id="files" name="files[]" multiple />
    <output id="list"></output>
    
    <script>
      function handleFileSelect(evt) {
        var files = evt.target.files;
        for (var i = 0, f; f = files[i]; i++) {
    
    
          var reader = new FileReader();
          reader.onload = function(e){
              var span = document.createElement('span');
              span.innerHTML =this.result;
              document.getElementById('list').insertBefore(span, null);
          }
    
          reader.readAsText(f);
        //reader.readAsArrayBuffer;
       //reader.readAsBinaryString;
       //reader.readAsDataURL
    } } document.getElementById(
    'files').addEventListener('change', handleFileSelect, false); </script> </body> </html>
  • 相关阅读:
    linux基本命令
    Linux中常用的50个命令
    Selenium2之XPath定位
    Selenium2浏览器启动及配置
    python学习内容.05
    python学习内容.04
    python学习内容.03
    python学习内容.02
    python学习内容.01
    RESTful
  • 原文地址:https://www.cnblogs.com/diligenceday/p/3492823.html
Copyright © 2020-2023  润新知