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";
.
精彩评论