Monday, March 19, 2012

digital clock using javascript

we can create digital clock using javascript using given code


example:-



Digital Clock By Critical Codes

hour : minute : sec :

code:-

<html>
<head>
</head>
<body>
<script language="javascript">
function func()
{
mydate=new Date();
h=mydate.getHours();
m=mydate.getMinutes();
s=mydate.getSeconds();
document.f.h.value=h;
document.f.m.value=m;
document.f.s.value=s;
}
window.setInterval("func()",1000)
</script>
<h3 align="center">Digital Clock By Critical Codes</h3>
<br><br>
<center>
<form name="f"> <font color="green">
hour : <input type="text" name="h" size="2">
minute : <input type="text" name="m" size="2">
sec : <input type="text" name="s" size="2"></font>
</form>
</center>
</body>
</html>

No comments:

Post a Comment