js_ javascript中调用自定义函数function

Default.aspx

 1 <script>
 2    //自定义函数
 3     function pageInit() {
 4         let data = [];
 5         var source_data = my_source_data();   //my_source_data是一般程序Handler.ashx中,自定义的方法
 6         var my_data = source_data.split('###');
 7         for (i = 0; i < my_data.length; i++) {   //my_data.length 表示有多少行记录
 8             data[i] = my_data[i].split(',,,');
 9         }
10     };
11 
12     //获取数据,再用jspreadsheet展示。
13     jspreadsheet(document.getElementById('mytable'), {
14         data: data,
15         columns: [            //显示的列,title是列名,type是数据库字段名
16             { type: 'id', title: 'DBid', readOnly: true, },
17             { type: 'type', title: 'type', readOnly: false, },
18             { type: 'Shipto', title: 'Shipto', readOnly: false, },
19             { type: 'Soldto', title: 'Soldto', readOnly: false, },
20         ],
21     });
22 
23 </script>
24 
25 <script>
26     pageInit();
27 </script>

 

posted @ 2023-04-07 09:44  AutomationAnywhere  阅读(121)  评论(0)    收藏  举报