Thursday 27 February 2014

Digital Clock in Browser





Click button will show clock.

here is code

<HTML>
<head><title></title>
<script>

function time()

{
var d=new Date();
H= d.getHours();
M= d.getMinutes()
S= d.getSeconds()
document.getElementById("timer1").innerHTML= H +":"+M +":"+S;
setTimeout(function(){time()},500);
setInterval(function(){time()},1000);
}
</script>
</head>
<body>


<div id="timer1" style="float:right";>
<button type="button" onClick="time();"style="float:right">Clock</button><br />
</div>
</body>

No comments:

Post a Comment