[問題] 如何傳值
想請教各位前輩~
我有一個class 叫 CarouselItem
在這裡頭我想要加入圖片的Width and Height Data
所以我用_image.onload的方式去取得圖片尺寸
但是想很久就是不曉得該怎麼把值給傳出來
想請大家給我意見<(_ _)> 程式碼如下,謝謝
function CarouselItem(Parent, HREF, ImageSRC, ImageAlt) {
this._parent = Parent;
this._ID = this._parent._ID + 'Item' + this._parent._items.length;
this._href = HREF;
this._element = null;
this._position = new Vector2D(0, 0);
this._size = this._parent._itemSize.Clone();
this._image = new Image();
this._imageH = 0;
this._imageW = 0;
this._image.onload = function () {
this._imageW = this.width; //這是錯的 i konw> <
this._imageH = this.height;
}
。
。
。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.63.100.2
※ 編輯: Qiu0 來自: 210.63.100.2 (09/06 17:47)
→
09/06 18:45, , 1F
09/06 18:45, 1F
→
09/07 11:02, , 2F
09/07 11:02, 2F
→
09/07 11:11, , 3F
09/07 11:11, 3F
→
09/07 11:11, , 4F
09/07 11:11, 4F
→
09/07 11:12, , 5F
09/07 11:12, 5F
→
09/07 11:13, , 6F
09/07 11:13, 6F
→
09/07 11:20, , 7F
09/07 11:20, 7F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章