Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 09-10-2007, 03:22 PM Image Swap on click
Experienced Talker

Posts: 37
Name: Sean
Trades: 0
I'm trying to create a image swap onclick. My goal is to have 5 buttons over one image and have that one image change when clicking on the buttons. I know how to code for a single swap and basic mouseovers but nothing like this. Do i have to use php for this function? Thankyou for your help.
sbova_99 is offline
Reply With Quote
View Public Profile Visit sbova_99's homepage!
 
 
Register now for full access!
Old 09-10-2007, 05:02 PM Re: Image Swap on click
Super Talker

Posts: 103
Name: Ewan T.
Location: Toronto
Trades: 0
Cant you use flash for that? Most websites do that.
Ewan is offline
Reply With Quote
View Public Profile Visit Ewan's homepage!
 
Old 09-10-2007, 05:49 PM Re: Image Swap on click
Experienced Talker

Posts: 37
Name: Sean
Trades: 0
I could use Flash. But was trying not to use it for this build.
sbova_99 is offline
Reply With Quote
View Public Profile Visit sbova_99's homepage!
 
Old 09-10-2007, 06:08 PM Re: Image Swap on click
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Sean you don't need Flash for this. Some basic JavaScript and DOM manipulation is all it will take.

One approach would be to give the image an id. Maybe id="swap"

Each of the 5 buttons might then call a JavaScript function using onclick. The function would find the image tag by its id.

var image = document.getElementByID("swap")

and then change the src of the image to whatever image you want to show for that button.

image.src = "path-to-image"

You'd probably pass the src for each image via the button when you call the function.

I hope that helps.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 09-10-2007, 06:28 PM Re: Image Swap on click
Experienced Talker

Posts: 37
Name: Sean
Trades: 0
Thanks! I'll give it a try.
sbova_99 is offline
Reply With Quote
View Public Profile Visit sbova_99's homepage!
 
Old 09-10-2007, 06:54 PM Re: Image Swap on click
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Sean feel free to come back and ask more if you're having any problems. If you can't get it working post your code or a link to the page in question and I'll take a look and see if I can help.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Image Swap on click
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.89223 seconds with 12 queries