Gossamer Forum
Home : General : Internet Technologies :

Javascript change image

Quote Reply
Javascript change image
Hi folks

When it comes to Javascript, I'll be the first to admit that I have absolutely no idea! :-\

Here's what I'm trying to do. I wonder if anyone can help me ...

I've got 5 thumbnails, when the user clicks on the thumbnail, the relevent image loads up as a bigger picture. This isn't a problem. I'm simply using something like:

Code:
<img src="/images/ecards/06b.jpg" name="card" width="496" height="234" border="0">

<a href="#" OnClick="card.src='/images/ecards/02b.jpg';">

Which instructs the browser to change the "card" image to the one defined when someone clicks on the thumbnail.

Now, however, I need to know which image the user clicked on when the page gets submitted by a form. I think the way I want to do this, is when the user chooses a thumbnail, it writes the to the body of the page the filename chosen, but maybe write it to <input type="hidden" ...> tags, so I can carry this across with me to the next page.

If anyone knows how to do this, or know of a better way -- please let me know!

Thanks!

- wil

Last edited by:

Wil: Aug 19, 2002, 6:48 AM
Quote Reply
Re: [Wil] Javascript change image In reply to
Found the answer.

Code:
document.forms.cards.img.value='../images/ecards/02b.jpg'

<input type="hidden" name="img" value="NULL">

- wil