[Javascript] problem with status line
Brian
wobbly at optonline.net
Mon Aug 8 22:14:51 CDT 2005
I'm new to JavaScript and am using O'Rielly's book, JavaScript The
Difinitive Guide to help me along.
The following is a script from the book that displays a digital clock
in the status bar:
------------------------------------------------------------------------
--------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>XHTML 1.0 Strict Template</title>
<meta http-equiv="Content-type" content="text/html;
charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript">
function display_time_in_status_line()
{
var d = new Date();
var h = d.getHours();
var m = d.getMinutes();
var s = d.getSeconds();
var ampm = (h >= 12)? "PM":"AM";
if (h > 12) h -= 12;
if (h == 0) h = 12;
if (m < 10) m = "0" + m;
if (s < 10) s = "0" +s
var t = h +':' + m + ":" + s + " " + ampm;
defaultStatus = t;
setTimeout("display_time_in_status_line()" , 100);
}
</script>
</head>
<body onload="display_time_in_status_line();">
</body>
</html>
------------------------------------------------------------------------
-------------------------------
After (hopefully) finding all the typos and trying different script
tags I got this script to work fine in Safari 1.3 (v312), Netscape 7.1
and Internet Explorer 5.2 for the Mac, I'm working on a G4 iBook.
When I run this script in Camino 2005042806 (v0.8.4) the time is just
time-stamped in the status line and it doesn't work at all in Firefox
1.0
Any ideas?
Thanks, Brian
More information about the Javascript
mailing list