Feedback on: irt.org FAQ Knowledge Base Q427
Comments:
Q427 How do I swap two images that are not of the same size?
CURRENT ANSWER:
You can't. Resize the images first, or add blank white space in the images to fill them out so that they are all the same size.
ADDENDUM:
You can. Omit the height and width specifications. (I use IE5 on W95)
Worth:
Worth reading
Length:
Just right
Technical:
Just right
Comments:
var newImagePath = "myLargerImage.jpg";
// create a temp copy of the image to get the size (necessary for IE)
tempImage = document.createElement('img');
tempImage.setAttribute('src', newImagePath);
mainImage.setAttribute('src', newImagePath);
mainImage.setAttribute('width', tempImage.width);
mainImage.setAttribute('height', tempImage.height);