Quote:
|
Originally Posted by Dark-Skys99
Javascript can do the trick, by changing the source of the images, like so..
HTML Code:
<script type="text/javascript">
function change() {
document.getElementById('button').src = "whatever.gif";
document.getElementById('otherone').src = "whatever.gif";
}
</script>
<img src="button.gif" alt="" id="button" onmouseover="change();" />
<img src="whatever.gif" alt="" id="otherone" />
|
cool, but I would say to use the 'images' collection. that's what it is there for. kill the 'id' or keep it, but give the images a 'name' attribute as is standard.
refer to like so, document.images.imageName.src / document.images["image_name"].src
and it's always best to pre-load the images before hand, otherwise, there is a download time upon rollover, before the images are displayed.
var pre_loaded_image = new Image();
pre_loaded_image.src = "images/my_image.jpg";
document.images.myImage.src = pre_loaded_image.src;
walla.
|