Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Image rotation (changing) javascript

Image rotation (changing) javascript
Thread Tools
Junior Member
Join Date: Jan 2006
Status: Offline
Reply With Quote
May 25, 2006, 09:29 AM
 
I'm trying to find a javascript that will let me rotate a different image on a web page at certain intervals. Mine needs to be specific, though. I have found some scripts that will change an image every day or randomly every time you visit the site.

However, I need a script that will change the image on Monday every week. I have a folder of 10 images and it needs to cycle through them in order (image_01-10) and after the 10th one start back at number 1 again.
If anyone knows of a script like this I'd appreciate letting me know. I have been looking around for a while now.
Thanks!
     
Professional Poster
Join Date: Jan 2001
Location: Salt Lake City, UT USA
Status: Offline
Reply With Quote
May 26, 2006, 10:05 AM
 
Code:
// Day of Week Image Script // copyright Stephen Chapman, 12th Feb 2005 // you may copy this script but please keep the copyright notice as well function dayOfWeekImage() { var dow = new Array('sunday','monday','tuesday','wednesday','thursday','friday','saturday'); var now = new Date; var dayNow = now.getDay(); var img = dow[dayNow]; document.write('<img src="graphics\/'+img+'.gif" width="200" height="80" alt="'+img+'\'s image" title="'+img+'\'s image" />'); }
I just found this, it's not exactly what you're looking for, but it's a start. write a simple if() statement about mondays. You'll probably need to keep a separate file that keeps track of which image you're on.
2008 iMac 3.06 Ghz, 2GB Memory, GeForce 8800, 500GB HD, SuperDrive
8gb iPhone on Tmobile
     
   
Thread Tools
Forum Links
Forum 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 On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:49 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2