var pastResult = []; pastResult.push(feature.attributes.F_iID); pastResult.push(feature.attributes.F_sName); pastResult.push(feature.attributes.F_sAddress); 得到的结果是: 想要把默认的0、1、2,改成F_iID、F_sName、F_sAd...
pastResult是数组,所以只能用0,1,2
1 2 3 4 5 6 7 8 9 | // 用对象 var pastResult = {}; pastResult[ 'F_iID' ] = feature.attributes.F_iID; pastResult[ 'F_sName' ] = feature.attributes.F_sName; pastResult[ 'F_sAddress' ] = feature.attributes.F_sAddress; alert(pastResult[ 'F_iID' ]); alert(pastResult[ 'F_sName' ]); alert(pastResult[ 'F_sAddress' ]); |