怎么用JS读写本地文本文件

JavaScript012

怎么用JS读写本地文本文件,第1张

采用jquery的ajax方式进行文件信息读取

代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

<html>

<head>

<script type="text/javascript" src="/jquery/jquery.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$("#b01").click(function(){

htmlobj=$.ajax({url:"/jquery/test1.txt",async:false})

$("#myDiv").html(htmlobj.responseText)

})

})

</script>

</head>

<body>

<div id="myDiv"><h2>通过 AJAX 改变文本</h2></div>

<button id="b01" type="button">改变内容</button>

</body>

</html>

nodejs作为功能强大的后端开发语言,有许多第三方包扩展nodejs能力。读写excel文件也有相关的第三方扩展。

本文介绍nodejs下如何通过使用node-xlsx扩展读写excel文件。