【发布时间】:2011-07-30 22:27:58
【问题描述】:
slider = options.images[n];
//slider is an object with: title, src etc. properties but without "width" and "height" properties.
// so that i want to change/add those two proerties in preload function
if( slider.width == undefined || slider.width == 0 ){
console.log('init for'+n);
tSlider.preload(slider.src, function(){
//this.width and this.height are real values
slider.width = this.width;
slider.height=this.height;
});
//why can not read the width and height?
slider.width == undefined;// true
}
【问题讨论】:
-
tSlider.preload 有什么作用?它是否使用具有
width和height属性的this值调用其第二个参数(函数)?
标签: javascript undefined