我有了一個格式的多個數據的文本文件:製表符分隔文本文件數組中的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