|
||||||
| JavaScript and CSS Extensible Markup Language, Java Script, and CSS questions here. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
hey guys, ive decided to have a dabble at javascript, on what i thought would be a minimalistic scale, and something not too complex... obviously i was wrong.
basically what i have is an image on an html page, and a set of links underneath labelled 1-6. What i would like to do is hav the user click on one of the other numbers, and the image switch to the picture corresponding to that number. so far i have this... but it doesnt seem to do anything as ive hit a brick wall! JavaScript Code:
|
| Sponsored Links |
|
|
|
|||||
|
Nothing strikes me as being wrong here. Can you post your link HTML code?
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog Don't hesitate to ask any questions that you have! Check out our ASCII Calculator! |
|
|||
|
well... if the javascript is right, then i guess that just means its implementing the javascript into the html tha tis the problem....
what i want is basically <img src="mainimage"></img> main image being taken from the javascript code, which should signify 1 of the 6 images. to choose the image, i have basically written, <a href="#" onclick="imagechange=1"></a> something to that effect.... |
|
|||||
|
I would suggest starting out with an empty <div> and use your javascript to build the <img src="whatever" /> as the innerHTML as the empty div...when when your links are clicked just change the innerHTML of your div to a different <img src="somethingelse" />.
Unless...you have a default image that you always want to display when the page loads...then i would suggest something like <img src="default.jpg" id="image"/> then when your links are clicked change document.getElementById('image').src = "newimage.jpg"; (or $('image').src = "newimage.jpg"; if you use prototype. Good Luck
__________________
Visit My Google Group Here: Web Development Innovation |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to make image straight - Photoshop | ahsan16 | Photoshop Tutorials | 56 | 07-30-2008 03:11 PM |
| JavaScript:Tutorial, MouseOver Image Change | TcM | Javascript | 2 | 10-30-2007 01:51 PM |
| image button problem | ikkeugh | Visual Basic Programming | 14 | 10-03-2007 03:55 PM |
| Resize Images And Maintain Original Sharpness | AfTriX | Photoshop Tutorials | 7 | 04-20-2007 09:55 AM |
| Using change management | Cosmet | General Programming | 2 | 10-30-2006 06:16 PM |
| John | ........ | 223.00000 |
| dargueta | ........ | 168.00000 |
| Xav | ........ | 164.00000 |
| LogicKills | ........ | 20.00000 |
| sam | ........ | 20.00000 |
| gaylo565 | ........ | 18.00000 |
| |pH| | ........ | 15.00000 |
| WingedPanther | ........ | 15.00000 |
| Johnnyboy | ........ | 3.00000 |
| navghost | ........ | 1.00000 |
Goal: 100,000 Posts
Complete: 67%