Click here to get back home

Swap image on clicking a link

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Swap image on clicking a link dougawells@gmail.com 06-03-2008
Posted by dougawells@gmail.com on June 3, 2008, 6:07 pm
Please log in for more thread options
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

Posted by Ed Jay on June 3, 2008, 7:22 pm
Please log in for more thread options
dougawells@gmail.com scribed:

>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

Google 'swap images'. There's a bunch. Then use onClick to call whichever
function you choose to use.

Ed Jay (remove 'M' to reply by email)

--
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info

Posted by Roderik on June 4, 2008, 12:55 am
Please log in for more thread options
dougawells@gmail.com schreef:
> 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

Similar ThreadsPosted
How do you swap foreground & background colors for a link (or any element)? September 20, 2005, 1:41 pm
How to lauch an image editor when click on an image link ? November 8, 2004, 7:00 am
I need "Select"(size=1) to show scrollbar when clicking down arrow August 16, 2007, 2:49 am
I need "Select"(size=1) to show scrollbar when clicking down arrow August 16, 2007, 2:50 am
link image border and validation January 30, 2008, 11:02 am
Swap images if Javascript is disabled June 27, 2006, 4:59 pm
Wtd: HTML editor to swap the order of columns in tables August 27, 2006, 7:05 am
Creating image maps with Adobe Illustrator or Image Ready. March 8, 2005, 12:42 pm
How can I replace a large image with other large images triggered from small image icons, mouse-overs or whatever??? July 26, 2004, 1:34 am
Text and Image inside table Alight Text Left and Image right in same cell ?? October 24, 2006, 12:55 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap