Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 13th, 2005, 07:20 AM
Authorized User
Join Date: Feb 2005
Location: delhi, delhi, India.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Swapping Images

Dear Friends ,

 Hope to find all of u in best spirits .
 I am facing a problem in javascript. basically i have four images which are coming from the database. i actually want to replace those images by clicking on a button (or image itself). basically a product has four views . (ie product is being seen from the four angles). when user clicks a button , those images got swapped .ie other image comes into the active window. (The Basic requirement is the funda of swapping images )

  infact Visit this link plz & click on the image


 How can i make that .
 i'll be thankful

Cheers :
K K Singh.

Why to be GOOD when U have the ability to be GREAT
Cheers :
K K Singh.

Why to be GOOD when U have the ability to be GREAT
Reply With Quote
  #2 (permalink)  
Old April 13th, 2005, 10:00 AM
Friend of Wrox
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo

this is very simple...

1. have the "id" and/or "name" attribute for the big image (example "bigImage")
2. when those links below are clicked, read and change "src" attribute of an <img>
3. you are done....

consider following:

<script language="JavaScript">

var imgs = new Array('photo1.gif','photo2.gif');

function setImage(index)
  document.getElementById('bigImage').src = imgs[index];


<img src="x.gif" name="bigImage" id="bigImage">
<a href="" onClick="setImage(1)"; return false;">photo1</a>
<a href="" onClick="setImage(2)"; return false;">photo2</a>

hope that helped

www.campusgrind.com - college portal
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
Images OldCoder ASP.NET 2.0 Professional 0 November 11th, 2007 09:17 PM
Session ID swapping from user to user... greenwar VS.NET 2002/2003 3 September 7th, 2007 08:44 AM
problem with swapping image into a div wilfordbrimley Javascript How-To 1 April 8th, 2006 04:52 PM
swapping characters in a string pritz VB How-To 1 August 22nd, 2005 12:19 PM

All times are GMT -4. The time now is 09:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.