Replace image without reloading or opening another page.

I want to replace one image with another larger image but I absolutely don't want to reload a page or open another window. Can this be done using a form INPUT (OnClick) or even an href anchor?

 If not, I guess JavaScript.  I'm using Win2003 server  and Coldfusion 8 standard. I have to assume there's no way to do this with the newer options in CF8.
JanrowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

buddistskaterCommented:
0
hieloCommented:
Try this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript"><!--
function swapImage(imgId,otherImg)
{
	document.getElementById(imgId).src = otherImg;
}
//--></script>
</head>
<body>
<img id="someImage" src="http://blog.nanovic.com.au/wp-content/uploads/2006/11/nano-flowers.jpg" alt="">
<input type="button" value="Swap Image" onclick="swapImage('someImage','http://www.missouriplants.com/Yellowopp/Helianthus_divaricatus_flowers.jpg')"/>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JanrowAuthor Commented:
Yes, that gets me on my way. It works. There will be three images, the MAIN image, and two alternate images., FRONT and BACK. But I'll need to display a return to the MAIN image but only if one of the alternate images is displayed.

I'll post a new question later because you've answered this one very well, and I thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.