current time display by java script code
<html>
<head>
<title>JS 2</title>
<script language="javascript">
function starttime()
{
var total=new Date();
var h=total.getHours();
var m=total.getMinutes();
var s=total.getSeconds();
m=checktime(m);
s=checktime(s);
document.getElementById("txt1").value=h+":"+m+":"+s;
var t1=setTimeout('starttime()',50);
}
function checktime(i)
{
if(i<10)
{
i="0"+i;
}
return i;
}
</script>
</head>
<body onload="starttime()">
Current System Time : <input type=text id=txt1>
</body>
</html>
No comments:
Post a Comment