这是我的代码:我有两个数组[lab,val],它们的值将动态传递给对象。k 是保存对象的数组
var lab = ["1","2","3",4];
var val = ["sa","ma","pa","da"];
var k = [];
for(var i=0; i<4; i++) {
data[i] = {};
data[i].label = lab[i];
data[i].value = val[i];
k.push(data[i]) ;
}
document.write(k.data[0]);
document.write(" " + k.data[0] + "<br />");