asatyss
10-08-2002, 11:15 PM
I am using an animated gif for a rollover effect on a button and was wondering if there was anyway, to set it up to complete the animation cycle before switching back to the still button. Basically, what I don't want to happen is for the animated gif to be halfway done witha cycle, and then the user mouses out and there is a kind of jolt effect back to the original image.
Is there any type of complete cycle piece of code I could throw in there?
Here are the related snippets of code.
<script>
img1On = new Image;
img1On.src = "ContactUsRoller.gif";
img1Off = new Image;
img1Off.src = "Copper Bar Contact2.jpg";
function swapImgs(img, imgSet) {
//change the image source to the rollover image
eval("document.images['"+img+"'].src ="+img+imgSet+".src");
}
</script>
...
<a href="contact.html"><img src="Copper Bar Contact2.jpg" height="20" border="0" name="img1"
onMouseOver="swapImgs('img1','On');"
onMouseOut="swapImgs('img1','Off');"></a>
Is there any type of complete cycle piece of code I could throw in there?
Here are the related snippets of code.
<script>
img1On = new Image;
img1On.src = "ContactUsRoller.gif";
img1Off = new Image;
img1Off.src = "Copper Bar Contact2.jpg";
function swapImgs(img, imgSet) {
//change the image source to the rollover image
eval("document.images['"+img+"'].src ="+img+imgSet+".src");
}
</script>
...
<a href="contact.html"><img src="Copper Bar Contact2.jpg" height="20" border="0" name="img1"
onMouseOver="swapImgs('img1','On');"
onMouseOut="swapImgs('img1','Off');"></a>