E
erikv
I'm having a hard time figuring out how to get the width of an image I
replace using the following code:
document.getElementById("sizeImg").src="http://www.example.com/image.jpg";
After this code, I try to snag the width of the new image using this:
document.getElementById("sizeImg").width
But I don't get the results I'm after in Firefox or IE. Firefox is
always one behind, meaning every time the image is replaced, the value
I get is the width of the previous image. IE always displays the
value as 0.
I've tried preloading the image after replacing it. I've tried a few
other things I found in this newsgroup, too. But I can't seem to get
the width of the image.
Does anyone know what I can do? I'd prefer it to work in Moz as well
as IE.
Thanks,
Erik
replace using the following code:
document.getElementById("sizeImg").src="http://www.example.com/image.jpg";
After this code, I try to snag the width of the new image using this:
document.getElementById("sizeImg").width
But I don't get the results I'm after in Firefox or IE. Firefox is
always one behind, meaning every time the image is replaced, the value
I get is the width of the previous image. IE always displays the
value as 0.
I've tried preloading the image after replacing it. I've tried a few
other things I found in this newsgroup, too. But I can't seem to get
the width of the image.
Does anyone know what I can do? I'd prefer it to work in Moz as well
as IE.
Thanks,
Erik