我有一个index.html文件,它将调用main.js。在main.js中,我基于文件中的值创建一个图形,为此,我需要读取目录并从文件中读取值。
如何使用JS从目录读取文件
index.html
aaa<p>Radio and<br/> television.<br/></p><p>very<br> popular in the world today.</br></p><p>Millions of people watch TV. </p><p>That’s because a radio is very small 98.2%</p><p>and it‘s easy to carry. haha100%</p>bb
main.js
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<head>
<!-- Plotly.js -->
</head>
<body>
<div id="myDiv" style="width: 480px; height: 400px;">
<!-- Plotly chart will be drawn inside this DIV -->
</div>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="./main.js"></script>
</body>
</html>