Sunday, 7 September 2014

Time controls

<script>
function abc()
{
x=new Date();
hours=x.getHours();
minutes=x.getMinutes();
seconds=x.getSeconds();
if (minutes < 10) minutes = "0" + minutes;
if (seconds< 10) seconds= "0" + seconds;
document.getElementById('check').innerHTML
     = "Time: " + hours + "/" + minutes + "/" + seconds;
setTimeout("abc()",1000);
}

/*
document.write("Hours = " + x);
document.write("<br>");
document.write("Hours= " + hours);
document.write("<br>");
document.write("Minutes = " + minutes);
document.write("<br>");
document.write("Seconds = " + seconds);

*/
</script>
<body onLoad="abc()">
<h1 align="center" id="check" style="font-size:50px;"></h1>

No comments:

Post a Comment