1. Home
  2. Computing & Technology
  3. JavaScript

Time of Day Image

4. Add to Your Page

Join the Discussion

Questions? Comments?

The final step in installing this script is to add the following code to the body of your web page where you want the image to appear.

<script type="text/javascript">
timeOfDayImage();
</script>

If you want to display one of the images to visitors whose browsers don't have Javascript enabled then add the following code immediately after the above code.

<noscript><img src=time5.gif" width="200" height="80" alt="time of day image - requires Javascript" /></script>

Of course anyone with Javascript disabled will always see the same image (the above code shows the noon image) but at least the layout of your page wont be affected the way it could be if you didn't show one in this instance.

1 | 2 | 3 | 4
Explore JavaScript
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.