开发者

IE9 and IE8 loading image set a width

var img_src="/xxx.jpg";
var img = new Image();
img.src = img_src;
 //img.height=height;
 img.width=200;
 img.removeAttribute('heigh开发者_JAVA百科t');

The Image is loading with default size in IE8 and IE9 and i have checked it in google chrome and firefox it is working fine.


Width or Height have to be set with units like:

img.width = "200px";


I suspect IE overwrites the width and height attributes when the image loads. To work around the problem, use img.style.width = "200px"; img.style.height = "auto";.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜