本帖最后由 fishecho 于 2013-03-22 10:10:14 编辑

解决方案 »

  1.   

    嘻嘻,问题有good code friend解决了。是因为m这个变量到最后会是35,而image.onload会延迟,到了最后,所有的image都会指向第35个image对象,所以才会产生这样的问题。解决方法是把image.onload中的image改为image.onload,即如下所示:for(var m = 0; m < j; m++) {
            var image = new Image();
            image.src = myPAttrs[m];//myPAttrs[m]这是一个已经确定的值了。
            console.log("image.src:lala" + image.src);//能够正常返回
            image.onload = function() {
                console.log("lala my M:" + m);
                console.log("image.src:" + this.src);
                console.log("height:" + this.height);
                console.log("width:" + this.width);
                this.onload = null;
            }