YellowSwordfish
Programmer
Hi - I'm new to Javascript! I found a routine that I wanted to adapt. Simple and lightweight, it resizes a large image to a specified thumbnail size but when clicked on resizes to full size. I adpated it to accept an array of images and it works fine on all browsers except IE6 and I just can't figure out why... If any js guru out there can point me in the right direction I would be grateful.
Here's the simple routine:
I tried it using image 'name' as well and also using getElementByID instead of document.images.
It's called by the image tag onClick and onLoad.
And it's just IE6 that doesn't play nicely.
Anyone able to advise what I am doing wrong?
Thanks and regards
Andy
Here's the simple routine:
Code:
var saveImgWidth = [];
function scaleImg(imageID, displayWidth)
{
var currentImg = document.images[imageID];
if (currentImg.width>(displayWidth) || saveImgWidth[imageID]>(displayWidth))
{
if (currentImg.width==(displayWidth))
currentImg.width=saveImgWidth[imageID];
else
{
saveImgWidth[imageID] = currentImg.width;
currentImg.style.cursor = "pointer";
currentImg.width=(displayWidth);
currentImg.style.visibility = "visible";
}
}
}
I tried it using image 'name' as well and also using getElementByID instead of document.images.
It's called by the image tag onClick and onLoad.
And it's just IE6 that doesn't play nicely.
Anyone able to advise what I am doing wrong?
Thanks and regards
Andy