在循环中尽量不要多次使用 “ds.Tables[0].Rows[i].”你可以先就把它赋个一个对象。也就是说在多次循环的时候,只需要去取一次ds.Tables[0].Rows[i].”就可以了以下为原程序
for(var i = 0; i < ds.Tables[0].Rows.length; i++){//debugger;//开始循环遍历
//获取所有细节,并赋值
var strDAY = ds.Tables[0].Rows[i].FDATE;
var strETIME = ds.Tables[0].Rows[i].FTIME;
var strIIIII = ds.Tables[0].Rows[i].IIIII;
var strBKIND = ds.Tables[0].Rows[i].KIND;
var strTYPE = ds.Tables[0].Rows[i].RSFLAG;
var strBFCC = ds.Tables[0].Rows[i].BFCC;
var strSKIND = ds.Tables[0].Rows[i].SUBKIND;
var strZNAME = ds.Tables[0].Rows[i].ZNAME;
var X = ds.Tables[0].Rows[i].LONG;
var Y = ds.Tables[0].Rows[i].LATI;
}代码太长了,只找到这么一个可以优化的地方
for(var i = 0; i < ds.Tables[0].Rows.length; i++){//debugger;//开始循环遍历
//获取所有细节,并赋值
var strDAY = ds.Tables[0].Rows[i].FDATE;
var strETIME = ds.Tables[0].Rows[i].FTIME;
var strIIIII = ds.Tables[0].Rows[i].IIIII;
var strBKIND = ds.Tables[0].Rows[i].KIND;
var strTYPE = ds.Tables[0].Rows[i].RSFLAG;
var strBFCC = ds.Tables[0].Rows[i].BFCC;
var strSKIND = ds.Tables[0].Rows[i].SUBKIND;
var strZNAME = ds.Tables[0].Rows[i].ZNAME;
var X = ds.Tables[0].Rows[i].LONG;
var Y = ds.Tables[0].Rows[i].LATI;
}代码太长了,只找到这么一个可以优化的地方
//获取所有细节,并赋值
var row = ds.Tables[0].Rows[i];
var result={
“DAY” : row.FDATE,
“ETIME”:row.FTIME,
“IIIII”:row.IIIII,
“BKIND”:row.KIND,
“TYPE”:row.RSFLAG,
“BFCC”:row.BFCC,
“SKIND”:row.SUBKIND,
“ZNAME”:row.ZNAME,
“X”:row.LONG,
“Y”:row.LATI
}
}
我只能优化到这样了
再想优化就要在其它方面下功夫