Forum
Notifications
Clear all
Topic starter
Another free script from Xhanch Studio that will display a running/ticking digital clock on your web page or on your browser's title and status. The time will be displayed based on visitor's local computer time.
This script can be run well using Mozilla Firefox (any version), Internet Explorer (any version), Opera and Fast Browser.
<html>
<head>
<title>Ticking Clock</title>
<script language="JavaScript">
// By : Xhanch Studio
// URL : http://xhanch.com
function start_clock(){
dt = new Date;
dt_hh = dt.getHours();
if(dt_hh.toString().length == 1)
dt_hh = "0" dt_hh;
dt_mm = dt.getMinutes();
if(dt_mm.toString().length == 1)
dt_mm = "0" dt_mm;
dt_ss = dt.getSeconds();
if(dt_ss.toString().length == 1)
dt_ss = "0" dt_ss;
dt_str = dt_hh ":" dt_mm ":" dt_ss;
//Displaying the digital clock
//Choose one of these three options
//First option - diplay it in the browser title
document.title = dt_str;
//End of first option
//Second option - diplay it in the status bar
window.status = dt_str;
//End of second option
//Second option - diplay it in a HTML element
element_id.value = dt_str;
//End of second option
setTimeout("start_clock()",1000);
}
</script>
</head>
<body onload="start_clock()">
<input type="text" size="15" id="element_id"/>
</body>
</html>
Posted : 04/04/2011 1:15 am