Navigation Menu
Alphabetical Listing
Site Contents

Site FAQ
About JSS
JavaScript Forum
JavaScript Tutorial
Friends of JSS

Link to Us
JavaScript Help
Contribute a script
Technology Jobs

Become a Partner

Internet.commerce

Be a Commerce Partner


Developer Channel

FlashKit.com
JavaScriptSource
Developer Jobs
ScriptSearch
WebDeveloper.com
Webreference
HTMLGoodies
HTML5 Dev Center
Developer.com
jGuru.com
PHPBuilder

Great Sites

DocJavaScript.com
dhtml.com
The Freebie Directory
TheFreeSite.com

Browse Doc JS's Tips!


Hiermenus Central


Promotions

Free Announcements


Social Bookmark

General

Use this script to change a picture (or banner) depending on the time of the day. Very simple to use!


This picture would display between 7 AM and 5PM
time of day

This picture would display between 5PM and 7 AM
time of day

Notes

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: timePictureChange.js


Head

Paste this code into the HEAD section of your HTML document.


Body

Paste this code into the BODY section of your HTML document


User Comments

Add a comment, suggestion, or correction
[For questions about usage, consult the Notes tab above or visit the JavaScript forum. Do not include more than two (2) lines of code in your comments. If you have suggestions or corrections, you can submit them to us.]

    
   
       
[optional]
 
[optional]

   

Comments feed Comment Feed RSS 2.0

6. From: Mark
Great Script... we use it !
10/14/2008 19:58:47

Hey !
This script is real cool ! Works great !!
(Wish it would support the blend effects...)
We will use it in our Toolbar... MusicPlayer !

Keep up the great work
Mark

9. From: Marissa
Code Addition
09/08/2008 19:40:22

I love the code, can you update it so it makes everyday different as well as every hour?

10. From: Lee (Admin)
11/06/2008 11:11:41

You would need to contact to author of script, or hack this one yourself. If you do change this one, we would be glad to add it to our site.

7. From: Andrea
08/29/2008 03:48:12

Hi,

I need to do like the same script but instead of time and images, I need text to be changed automaticly.

Like for example game fixtures change automaticly when that date comes and is replaced by the next game.

Any help please!!!

Thanks!!

8. From: Lee (Admin)
11/06/2008 11:10:03

Well, that would be a different script.

3. From: Dan
Thank You!
07/12/2008 16:26:54

I added it to a page and it works well!
I added some extra bits to the (img src=) line and it works with a web cam timed refresh script.

so at 05:00hrs the offline image becomes the online image for any one that opens the page 05:00 ETC.

I would Put a link to the page but it is only internal at the moment.

Thank You, for the script!

4. From: John B. Moss
JPGs work - but pics tied to script source?
06/08/2008 12:32:06

I got the code to work by making 'pic1.gif' and 'pic2.gif' my targeted pictures. I wanted to control this from the body statement, but couldn't get 'src=""' to accept my targeted pictures. I tried a comma-separated delimiter, with and without single quotes (src="a.jpg,b.jpg" and src="'a.jpg','b.jpg'") to no avail. Is it possible to supply the target pictures from the body?

5. From: Lee (Admin)
10/31/2008 14:32:30

Your question is beyond the scope of these comments. You will need to post it over on the JavaScript forum. Thanks!

1. From: Carlos
Format compatibility
05/04/2008 22:47:26

Does it work with jpg images?, because i couldn't make it work.

2. From: Lee (Admin)
05/12/2008 10:49:09

Sure, should be no reason why it shouldn't. You might want to submit your question to the JavaScript forums.


Do you write JavaScripts?
If you do, why not submit them to us?
We'll give you credit and a link back to your Web site.