<HTML><HEAD>
<!--
-----------------
StatusBar Time #3
-----------------
-->
<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers
/*
THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
Copyright (C)1998 by Charles River Media. All Rights Reserved.
This applet can only be re-used or modifed by license holders of the
JavaScript Cookbook CD-ROM. Credit must be given in the source
code and this copyright notice must be maintained. If you do
not hold a license to the JavaScript Cookbook, you may NOT
duplicate or modify this code for your own use.
Use at your own risk. No warranty is given or implied of the suitability
of this applet for any specific application. Neither Erica Sadun nor
Charles River Media will be held responsible for any unwanted effects
due to the use of this applet or any derivative.
*/
var JSCindex=0
var str=""
function pad(digit)
{
if (digit < 10) return "0"+digit; else return ""+digit
}
function setMessage()
{
now = new Date()
day = ("The time is "+pad(now.getHours()))+
":"+(""+pad(now.getMinutes()))+
":"+(""+pad(now.getSeconds()))
str = ""
for (var ii = 0; ii < JSCindex; ii++) {str = str + " "}
str = str + day
window.status = str
JSCindex = JSCindex + 1
if (JSCindex == 120) JSCindex = 0
JSCTimeOutID = window.setTimeout('setMessage()',100)
}
<!-- done hiding --></SCRIPT></HEAD>
<BODY bgcolor="ffffff" link="0000ff" vlink="770077"
onload="JSCTimeOutID = window.setTimeout('setMessage()',500);">
<FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50
ALIGN = LEFT>Status Bar Time #3</H1></FONT>
<BLOCKQUOTE><FONT COLOR="770000">
This script scrolls the current time across the status bar.
The time scrolls by adding a series of "blank" characters before
the time.
</FONT></BLOCKQUOTE>
<BR><BR>
<FONT COLOR="007777"><H2>Discussion</H2></FONT>
<FONT SIZE=4>
Like previous scripts, this JavaScript sets an initial
timeout in the BODY that is renewed in a function call.
However, instead of simply loading the time, it scrolls it.
See the <a href="../STATUS/CONT.HTM" target="JCidx">StatusBar</a>
recipes for more ideas.
</FONT>
<h5>Copyright ©1998 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>