Jump to content

swaping images


mediasix

Recommended Posts

Hi,

I want to acheive something that i am unsure how to do.

i want to have a picture of say 400px by 400px with several thumbnails of 50px by 50px underneath.

when you click on each one, it will change the 400px by 400px image, no matter which one you click on.

i have some code but dont think that it is sufficient. (the code is for onmouseover but i want it for onclick

<img src="images/01.jpg" alt="image01" name="image01" id="image01">
<img src="images/02.jpg" alt="image02" name="image02" id="image02" onclick="image01.src='images/image02.jpg'>

please help

thanks in advance

mediasix

Link to comment
Share on other sites

not to worry i answered my own question, here is the code below.

my only question is, how could i make it work with the alt attribute??

cheers

mediasix  :)

<html>
<head>
<script type="text/javascript">
if (document.images) {
image01 = new Image;
image02 = new Image;
image01.src = 'images/01.jpg';
image02.src = 'images/02.jpg';
} else {
image01 = '';
image02 = '';
document.rollimg = '';
}
</script>
</head>
<body>
<p align="center"><img src="images/01.jpg" border="0" alt="Larger version of one of the smaller images below" name="rollimg" /></p>

<p align="center">
<img src="images/01small.jpg" onclick="document.rollimg.src=image01.src;" />
<img src="images/02small.jpg" onclick="document.rollimg.src=image02.src;" />
</p>
</body>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.