【发布时间】:2010-12-23 00:34:14
【问题描述】:
我的意思不是使用<img src="URL" width="Xy%" height="za%"> 调整大小,尽管它的外观与我的目标相同。我想要类似僵尸狗代码here 的东西,但图像大小任意。请阅读我代码中的 cmets。
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="" />
<Content type="html">
<![CDATA[
// This won't change the size of the image but the size of div.
<style type="text/css">
#zombiecontainer{
height:100%;
width:100%;
}
</style>
// I want to specify the size of the image with Div -block relative to the size
// of iGoogle gadget.
<div id="zombiecontainer"
style="text-align:center;" width="100%" height="100%">
</div>
<script type="text/javascript">
var images = new Array();
images[0] = _IG_GetImage("https://pictures/friends.jpg");
// How can I do it with the div? I don't want to create a static picture
// and put the code to the div block. I want to be able to change it,
// hopefully, with below commands. No more messy HTML.
_gel("zombiecontainer").innerHTML = "";
_gel("zombiecontainer").appendChild(images[0]);
</script>
</div>
]]>
</Content>
</Module>
【问题讨论】:
-
<img width>和<img height>只接受无单位值;您只能在 CSS 属性中使用统一值。