DATE AND TIME

copy this code save as .html


<html>
<head>
<script Language="JavaScript">
<!-- hide
var timeStr, dateStr;
function clock() {
now= new Date();
// time
alert(now);
hours= now.getHours();
minutes= now.getMinutes();
seconds= now.getSeconds();
timeStr= "" + hours;
timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;
window.status="Now the time is"+timeStr;
document.clock.time.value = timeStr;
// date
date= now.getDate();
month= now.getMonth()+1;
year= now.getFullYear();
dateStr= "" + month;
dateStr+= ((date < 10) ? "-0" : "-") + date;
dateStr+= "-" + year;
document.clock.date.value = dateStr;
Timer= setTimeout("clock()",2000);
}
// -->
</script>
</head>
<body onLoad="clock()">
<form name="clock">
Time:
<input type="text" name="time" size="8" value=""><br>
Date:
<input type="text" name="date" size="8" value="">
</form>
</body>
</html>

Comments

Popular posts from this blog

special style

RANDOM

DIFFERENT BUTTONS