dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Time rotating images

  1. #1
    Join Date
    Jun 2003
    Location
    Phoenix, AZ
    Posts
    9

    Unhappy Time rotating images

    I have a script on my site 1100kfnx.com that shows different images depending on the visitor's clock (I think). As seen below, it varis from hour to hour. But how can I make it so the images seen below are shown during their respective times Monday-Friday only, and either a separate set of images or just one generic one is shown on weekends? You can see example at the site.

    <script>

    //Time of day message script- by javascriptkit.com
    //Visit JavaScript Kit (http://javascriptkit.com) for script
    //Credit must stay intact for use

    var Digital=new Date()
    var hours=Digital.getHours()

    //Configure message below to your own.
    if (hours>=6&&hours<9) //MORNING
    document.write('<img src="/kfnx/images/onair/morning.gif" border=0>')
    else if (hours>=9&&hours<10) //SAM
    document.write('<img src="/kfnx/images/onair/drsam.gif" border=0>')
    else if (hours>=10&&hours<11) //SYDNEY
    document.write('<img src="/kfnx/images/onair/sydney.gif" border=0>')
    else if (hours>=11&&hours<13) //MOHAN
    document.write('<img src="/kfnx/images/onair/mohan.gif" border=0>')
    else if (hours>=13&&hours<15) //CHARLES
    document.write('<img src="/kfnx/images/onair/charles.gif" border=0>')
    else if (hours>=15&&hours<18) //NEWCOMB
    document.write('<img src="/kfnx/images/onair/newcomb.gif" border=0>')
    else if (hours>=18&&hours<20) //DAYL
    document.write('<img src="/kfnx/images/onair/dayl.gif" border=0>')
    else if (hours>=20&&hours<22) //BOLLING
    document.write('<img src="/kfnx/images/onair/bolling.gif" border=0>')
    else if (hours>=22&&hours<1) //VORTEX
    document.write('<img src="/kfnx/images/onair/vortex.gif" border=0>')
    else if (hours>=1&&hours<5) //HOT
    document.write('<img src="/kfnx/images/onair/hottalk.gif" border=0>')

    </script>

    Thanks

  2. #2
    Join Date
    Apr 2003
    Location
    UK
    Posts
    2,203
    Please try the following, you will need an image for sat & sun


    <script>

    //Time of day message script- by javascriptkit.com
    //Visit JavaScript Kit (http://javascriptkit.com) for script
    //Credit must stay intact for use

    var Digital=new Date()
    var hours=Digital.getHours()
    var day=Digital.getDay()

    if(day>0&&day<6){
    //Configure message below to your own.
    if (hours>=6&&hours<9) //MORNING
    document.write('<img src="/kfnx/images/onair/morning.gif" border=0>')
    else if (hours>=9&&hours<10) //SAM
    document.write('<img src="/kfnx/images/onair/drsam.gif" border=0>')
    else if (hours>=10&&hours<11) //SYDNEY
    document.write('<img src="/kfnx/images/onair/sydney.gif" border=0>')
    else if (hours>=11&&hours<13) //MOHAN
    document.write('<img src="/kfnx/images/onair/mohan.gif" border=0>')
    else if (hours>=13&&hours<15) //CHARLES
    document.write('<img src="/kfnx/images/onair/charles.gif" border=0>')
    else if (hours>=15&&hours<18) //NEWCOMB
    document.write('<img src="/kfnx/images/onair/newcomb.gif" border=0>')
    else if (hours>=18&&hours<20) //DAYL
    document.write('<img src="/kfnx/images/onair/dayl.gif" border=0>')
    else if (hours>=20&&hours<22) //BOLLING
    document.write('<img src="/kfnx/images/onair/bolling.gif" border=0>')
    else if (hours>=22&&hours<1) //VORTEX
    document.write('<img src="/kfnx/images/onair/vortex.gif" border=0>')
    else if (hours>=1&&hours<5) //HOT
    document.write('<img src="/kfnx/images/onair/hottalk.gif" border=0>')
    }

    if(day==6||day==0){
    document.write('<img src="/SATURDAY AND SUNDAY IMAGE.gif" border=0>')
    }
    </script>

  3. #3
    Join Date
    Jun 2003
    Location
    Phoenix, AZ
    Posts
    9
    Works on dummy site, will transfer. Thanks a lot, I've been trying to figure that out for a looong time

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles