我有了一个格式的多个数据的文本文件:制表符分隔文本文件数组中的JavaScript
1 2016-01-01 17:23:24 0 0 1 1
2 2016-02-01 07:15:23 0 0 2 1
1 2016-03-01 12:13:24 0 0 1 1
3 2016-04-02 13:34:19 0 0 3 1
.....
代码:
<table>
<tr>
<td colspan="2" style="font-weight:bold;">
Upload time sheet for yards with biometrics
</td>
</tr>
<tr>
<td colspan="2" style="font-weight:bold;">
<input type="file" name="fileUpload" id="fileUpload" size="40">
</td>
</tr>
<tr>
<td colspan="2" >
</td>
</tr>
<tr>
<th>Date From:</th><th>Date To:</th>
</tr>
<tr>
<td><input type="date" id="from_date"></td><td><input type="date" id="to_date"></td>
</tr>
<td colspan="2" align="right">
<input type="button" value="Process File" id="btn_process_file" onclick="Upload()">
</td>
</table>
我需要在每行获得一定的值该文件被放置在一个数组中。我只需要数组中每行的前3个“值”。基于以上我的样本,我只需要:
1 2016-01-01 17:23:24
2 2016-02-01 07:15:23
1 2016-03-01 12:13:24
为了使阵列,如:
var x = [[1,2016-01-01,17:23:24][2,2016-02-01,07:15:23][1,2016-03-01,12:13:24]]
var x = [[1,2016-01-01,17:23:24] [2,2016-02-01,07:15:23] [1,2016-03-01, 12:13:24]] '甚至没有有效的JS。请改善问题 – nozzleman