This is a discussion on "[SOLVED] Javascript Image Rotator" within the JavaScript Forum section. This forum, and the thread "[SOLVED] Javascript Image Rotator are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] Javascript Image Rotator
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] Javascript Image Rotator
[RESOLVED]
Hi, I recently found a great code to rotate images onLoad, either randomly or in order. Its a great code and all, but I would like to use it for something else, too. Unfortunately, I have not successfully customized it... The code is:
... and what I want to do is use the same code (with different variables) to also rotate captions for the images onLoad, in order. This is tricky, since the captions need to correspond with the images, otherwise, there's no point. The caption is inside a paragraph:
SWagner
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Last edited by Stuart; Sep 9th, 2007 at 18:04. Reason: Resolved |
|
|
|
#2
|
||||
|
||||
|
Re: Javascript Image Rotator
Okay you should be able to do this by adding another index to each image array...
Similar to :
So basically using the same principle as found in the checking the existence of img width and height the script will now check for a caption and update the paragraph accordingly - or it will default to your chosen text. Cheers, Rakuli
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
|||
|
|||
|
Re: Javascript Image Rotator
Thanks Rakuli,
It works very well. I put in the correct img srcs, and my pictures and captions come up the way they're supposed to. One other question, would there be a way to use class="caption" instead of id="caption"? It fits better with my CSS document: p.caption SWagner
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Last edited by Stuart; Sep 9th, 2007 at 18:57. |
|
#4
|
||||
|
||||
|
Re: Javascript Image Rotator
If you only have the one tag p.caption you can use p#caption to address the paragraph by ID instead.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#5
|
|||
|
|||
|
Re: Javascript Image Rotator
All right, I got it all set to p#caption now.
Thanks again for the advice
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
|
![]() |
| Tags |
| images |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PNG problem with php image rotator | bkbdesign | Web Page Design | 1 | Apr 10th, 2008 18:22 |
| [SOLVED] multiple image rollover not restoring image | snappy | JavaScript Forum | 4 | Nov 5th, 2007 14:38 |
| [SOLVED] Javascript/PHP Image Rotator | Stuart | PHP Forum | 28 | Oct 21st, 2007 22:37 |
| [SOLVED] display image if javascript not enabled | Voodoochilli | JavaScript Forum | 1 | Oct 4th, 2007 13:58 |
| Image rotator | aloysius | JavaScript Forum | 2 | Oct 2nd, 2006 22:12 |