我想知道是否可以使用数组获取对象属性。我得到 this.label[i].xOffset 的“未定义”值。有什么建议么?
function label() {
var lbl = this;
lbl.rText;
lbl.precision =1;
lbl.prefix = '';
lbl.suffix = '';
lbl.xOffset = this.width/2;
lbl.yOffset = this.height*82/100
}
this.NoOfneedles=2;
if (this.NoOfneedles > 1) {
this.label = [];
for (i=0;i<this.NoOfneedles;i++) {
this.label[i]=new label();
alert("label xOffset:"+this.label[i]+this.label[i].xOffset);
}
}