Results 1 to 3 of 3

Thread: Image Time Change

Hybrid View

  1. #1
    Join Date
    Dec 2011

    Image Time Change

    I'm new to this forum. I need to place two images on my website. I want from 12am to 4pm, to display "Off.png",
    4pm to 10pm, to display "On.png",
    10pm to 12am, to display "Off.png",

    How can I do this? I new to website work. But I'm a little slow on the javascript. I'm open to any method! If you can S-P-E-L-L out what I place, and where, that would be great.


  2. #2
    Join Date
    Dec 2011
    Ie like this (put this code anywhere where you want your image):
    <img src="" alt="" name="OnOff" id="OnOff" />
    <script type="text/javascript">
    var d = new Date();
    var elem = document.getElementById('OnOff')
    if ((d.getHours() > 16) && (d.getHours() < 23)) {
    	elem.src = 'On.png';
    	elem.alt = 'On';
    else {
    	elem.src = 'Off.png';
    	elem.alt = 'Off';

  3. #3
    Join Date
    Dec 2011
    Thanks, Works perfectly! I really owe you. See here: poestenkill-lights.com

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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