![]() |
|
|||||||
| JavaScript Programming Discuss javascript coding. |
| Have A Look At Some Of Our Webmaster Related Sponsors! | |||||
![]() Script Directory |
![]() Shopping Cart |
![]() Market Leverage |
![]() Free Templates |
![]() 3D Guide-characters |
![]() Advertise Here |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Field Master
|
with this script you can add a simple clock in your page
Code:
<HTML>
<TITLE>Clock</TITLE>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function showFilled(Value) {
return (Value > 9) ? "" + Value : "0" + Value;
}
function StartClock24() {
TheTime = new Date;
document.clock.showTime.value = showFilled(TheTime.getHours()) + ":" + showFilled(TheTime.getMinutes()) + ":" + showFilled(TheTime.getSeconds());
setTimeout("StartClock24()",1000)
}
//-->
</script>
<style type="text/css">
<!--
.input { border-style: none;
font-family:Verdana,Arial,Helvetica,sans-serif;
font-size:8pt
}
-->
</style>
</head>
<BODY bgcolor="#FFFFFF" onLoad="StartClock24()">
<center>
<br>
<br>
<u><font face="Arial, Helvetica, sans-serif" size="4">Simple Java Clock</font></u><br>
<br>
<br>
</font>
<form name=clock>
<input type=text name=showTime size=8 class=input>
</form>
</center>
</body>
</html>
|
|
|
|
|
|
#4 (permalink) |
|
New Hunter
Join Date: Dec 2007
Location: United Kingdom - Dorset - Bournemouth
Posts: 85
iTrader: 0 / 0%
Hunter Bux: 5.00
![]() ![]() |
I used a different technique:
Code:
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('time').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',100);
}
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|