Home / Free JavaScripts / Images & Music / Here

Cut & Paste Displaying different images according to time
Credit: JavaScript Kit

Description: The following script will display a different image onto your webpage, depending on whether it's mourning or night. (Note: Mourning is from 12 am to 12 pm)


Directions: Simply cut and paste the following script anywhere with the <body> tags. Please remember to change the gifs to yours.

/*By George Chiang (JK's JavaScript tutorial)
Credit must stay intact for use*/
var current= new Date()
var day_night=current.getHours()
if (day_night<=12)
document.write("<img src='day.gif'>")
document.write("<img src='night.gif'>")

JavaScript Tools:
Site Info

CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info