PDA

View Full Version : html thumbnail changes another image onclick



frumple
Mar 11th, 2008, 10:33 PM
i am an artist, not a coder, but i get by with simple stuff usually.

today i am at my wits end trying to get something that should be SO DARN SIMPLE out and i feel absolutely retarded and depressed that i can't get it to work.
i have a test page up with my issue, which is not working.
[url]http://www.mirawork.com/thumbtest.htm

have tried severall different approaches, i want the most very SIMPLEST basic approach.

thank you for any help.

jerry62704
Mar 11th, 2008, 10:38 PM
Your URL is incomplete. test.html, htm, php didn't work either just trying to get a jump on it.

Further, what is the problem? That it isn't displaying?

adams_station
Mar 11th, 2008, 10:41 PM
Hey, well i tried to look at your example but it doesnt seem to work. It sounds like a simple bit of javascript should sort you out though.

<script type="text/Javascript">

function swapImage(url){

var e = document.getElementById("idOfYourImage");
e.src = url;
}

</script>

place that in the head or as part of an external script and then for each thumb make a link in the form:

<a href="Javascript:swapImage("imagePathToDisplay");"> <img alt="..." src="..." /> </a>

Hope that helps.

Adam

frumple
Mar 11th, 2008, 10:42 PM
sorry, i edited url after posted, but it didn't apply it
it's mirawork.com/thumbtest.htm

adams_station
Mar 11th, 2008, 10:47 PM
You have:

getElementById("large").src="www.mirawork.com/alpineimages/alpine001.jpg

i think you need it to read:

document.getElementById("large").src="www.mirawork.com/alpineimages/alpine001.jpg

frumple
Mar 11th, 2008, 11:03 PM
i think i have found a site i can cut and paste from, which looks similar to what you have suggested actually (http://www.codetoad.com/dhtml_thumbnail_eg.asp)
i hate my limited brain right now.
thanks very much for help.

frumple
Mar 11th, 2008, 11:08 PM
to adams_station:

thanks very much for this, if i can't use this simple page i found to cutnpaste, i'll go back to my previous attempt. sludge in my brain right now lack of sleep and frustration.

You have:

getElementById("large").src="www.mirawork.com/alpineimages/alpine001.jpg

i think you need it to read:

document.getElementById("large").src="www.mirawork.com/alpineimages/alpine001.jpg

Andrew Johnson
Mar 11th, 2008, 11:22 PM
Change URLs from

"www.mirawork.com/alpineimages/alpine001.jpg"

to

"http://www.mirawork.com/alpineimages/alpine001.jpg"