MozTW 討論區
https://forum.moztw.org/

在Sidebar中append image後,調整width的問題
https://forum.moztw.org/viewtopic.php?f=46&t=30535
1 頁 (共 1 頁)

發表人:  whitescars1128 [ 2010-07-05, 16:00 ]
文章主題 :  在Sidebar中append image後,調整width的問題

xul中有段語法為:
<stack>
<vbox id="showImage" flex="1" style="overflow: auto">
</vbox>
</stack>

我想用javascript達成如下:
<stack>
<vbox id="showImage" flex="1" style="overflow: auto">
<image src="file://c:\\..." height="120" weight="120">
<image src="file://c:\\..." height="120" weight="120">
</vbox>
</stack>

javascript語法如下:
var target = document.getElementById("showImage");

while (...) {
temp = new Image();
temp.src = "file://c:\\...";
temp.height = 120;
temp.width = 120; ←對width的設定失效@@
target.appendChild(temp);
}

但此作法在sidebar中的image width無法被設定,
width依然為原圖大小,即"file://c:\\..."圖檔大小
height則可被順利設定成120

煩請大家幫個忙。

1 頁 (共 1 頁) 所有顯示的時間為 UTC + 8 小時
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/