Join Bytes! schreef:
Quote:
Originally Posted by
There are probably lots of good examples that I haven't found yet. I
want a link on a page to swap out two or three images that are on the
same page. Can someone please point me towards an example? I'm used to
doing this in Flash, not in HTML and Javascript.
Thanks
|
First hit from Google (
http://www.devx.com/tips/Tip/13653):
<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript>
intImage = 2;
function swapImage() {
switch (intImage) {
case 1:
IMG1.src = "http://www.microsoft.com/library/toolbar/images/mslogo.gif"
intImage = 2
return(false);
case 2:
IMG1.src =
"http://msdn.microsoft.com/msdn-online/start/images/msdn-logo.gif"
intImage = 1
return(false);
}
}
</SCRIPT>
</HEAD>
<BODY>
<IMG id="IMG1" name="IMG1"
src="http://www.microsoft.com/library/toolbar/images/mslogo.gif"
onclick="swapImage();">
</BODY>
</HTML>
The code is a bit old fashioned (there should be a type for the script
and it should be hidden somewhat from the html IMO) but it is prob. easy
to adjust it. Of course you could also choose to use the hover event or
any other.
--
http://www.archytas.nl/
webdesign, internet applicaties, internetgestuurde elektronica