Log in

View Full Version : Image Rotation based on Schedule



crashcarter
08-02-2008, 11:14 PM
Hello, I seem to have misplaced my code for running an image based on a schedule. I was wondering if anyone would have something similar?

It's basically a code that would run a certain image at a certain time eg: img 1 runs at 1pm monday thru friday, img 2 runs at 5pm monday thru friday and img 3 runs at 9am on saturday and sunday...

If you could possibly lead me in the right direction that would be so helpful!

Cheers,
C

Nile
08-03-2008, 02:28 AM
Take a look at this post on codingforums.com:
http://codingforums.com/showpost.php?p=703474&postcount=14

mburt
08-03-2008, 04:06 AM
<img id="myImage" alt="myImage" title="myImage">
<script type="text/javascript">
var date = new Date();
if ((date.getDay() > 0 && date.getDay() < 6) && date.getHours() == 14) {
document.getElementById("myImage")["src"] = "MON-FRI-2-OCLOCK-IMAGE.jpg";
};
</script>

crashcarter
09-16-2008, 01:13 AM
I was trying to get this script to work and can't seem to figure it out. Will I have a separate script for each image? If I was to have 5 different images per day would I have 5 scripts in the same place? ..or can I just add them right before the </script>