时间: 2020-09-3|tag:39次围观|0 条评论

<!DOCTYPE html><html>    <head>        <meta charset="UTF-8">        <title></title>    </head>    <body>        <input type='file' accept='text/plain' onchange='openFile(event)'><br>        <div id="output"></div>    </body>    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>    <script type="text/javascript">        var openFile = function(event) {            var input = event.target;            console.log('input'+input)            var reader = new FileReader();            reader.onload = function() {                if(reader.result) {                    //显示文件内容                    $("#output").html(reader.result);                }            };            reader.readAsText(input.files[0]);}    </script></html>

 

 

js 读取文本文件,日志内容插图

 

文章转载于:https://www.cnblogs.com/chaoren399/p/11226860.html

原著是一个有趣的人,若有侵权,请通知删除

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《js 读取文本文件,日志内容
   

还没有人抢沙发呢~