1 <!--得出一个永远不会重复的日期格式的字符串,包括毫秒,用于AJAX输出一个不重复参数,以避免不刷新,function全部写在head节点内-->
2 <script type="text/javascript">
3 function getNowTime() {
4 var date = new Date();
5 this.year = date.getFullYear();
6 this.month = date.getMonth() + 1;
7 this.date = date.getDate();
8 this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
9 this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
10 this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
11 this.milliSeconds = date.getMilliseconds();
12 var currentTime = this.year + '-' + this.month + '-' + this.date + ' ' + this.hour + ':' + this.minute + ':' + this.second + '.' + this.milliSeconds;
13 return currentTime;
14 }
15 </script>
1 <script type="text/javascript">
2 function pageInit() {
3 let data = [];
4 var source_data = my_source_data();
5 alert(source_data)
6 var my_data = source_data.split('###');
7 alert(my_data)
8
9 //更新:总记录的条数
10 total_records = Number(my_data[0]);
11 document.getElementById('spreadsheet').value = total_records;
12
13 //删除数组中的第一个元素:总记录的条数
14 my_data.splice(0, 1);
15 for (i = 0; i < my_data.length; i++) { //my_data.length 表示有多少行记录
16 data[i] = my_data[i].split(',,,');
17 };
18 </script>