Categories:

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)

Example:

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

<script>
<!--
/*By George Chiang (JK's JavaScript tutorial)
http://www.javascriptkit.com
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'>")
else
document.write("<img src='night.gif'>")
//-->
</script>

JavaScript Tools:
Site Info


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