?
Solved

image swap grid

Posted on 2010-01-12
6
Medium Priority
?
236 Views
Last Modified: 2013-12-25
My client is an artist. He wants to show a a grid of 9 images on a page. On clicking on an image, he wants it to change to another image which stays. So by the time the vistor clicks all nine images, they are looking a a completely different set of images than on entry.

Can anyone give any advice on the simplest way to do this.
0
Comment
Question by:mattybrown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26292750
for each image link you can have a onclick event which will call the following javascript function

<img src="" onclick="changepic(this)">

function changepic(thisObj)
{
thisObj.src=img_src;
}
0
 

Author Comment

by:mattybrown
ID: 26292990
So would that mean that by clicking each of the  nine initial images you could finish up with a completely different set of nine images on the same page?

0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 26293012
Yes

Now, if the question is which image will be replacing the existing one: You might want to store those image URLs in an array.
0
Stack Overflow Podcast - Developer Story

Welcome to the Stack Overflow podcast recorded Thursday July 20 at Stack Overflow Headquearters in NYC. Your hosts today are podcast regulars Jay Hanlon, David Fullerton, and Ilana Yitzhaki, plus the quite irregular Matt Sherman (Stack Overflow Engineering Manager extraordinaire)

 

Author Comment

by:mattybrown
ID: 26293066
Perfect. Thank you.

One other thing though. You said: 'those image URLs in an array'. Not too sure what you mean by this. The site will be a simple HTML site.

0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 26293119
I meant that the image URLs you want to replace to can be kept in a Javascript array (in case you want different image to be replaced with at each onclick).
0
 

Author Comment

by:mattybrown
ID: 26294305
Thank you. That's very helpful.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question