如何使用javascript从*.csv文件读取数据?
头1,头2,头3,头4,头5,值1 1,值2_1,值3_1,值4_1,值5_1,值1_2,值2_2,值3_2,值4_2.
[头1:值1,头2:值2,头3:值3,头4:值4,头5:值5_1],[头1:值1,头2:值2,头3:值3,头4:值4,头5:值5 2].
<script type="text/javascript">
var allText =[];
var allTextLines = [];
var Lines = [];
var txtFile = new XMLHttpRequest();
txtFile.open("GET", "file://d:/data.txt", true);
txtFile.onreadystatechange = function()
{
allText = txtFile.responseText;
allTextLines = allText.split(/\r\n|\n/);
};
document.write(allTextLines);<br>
document.write(allText);<br>
document.write(txtFile);<br></script>
慕雪6442864
凤凰求蛊
随时随地看视频慕课网APP
相关分类