Now, I can do it. I have a two text field. The first is time text field, and date text field. the problem is that I can't invoke both of date and time.
my code is following :
Quote:
<script language="javascript">
var my12_hour = 1;
var dn = "";
function show_clock()
{
var Digital = new Date();
var hours = Digital.getHours();
var minutes = Digital.getMinutes();
var seconds = Digital.getSeconds();
if (my12_hour) {
dn = "AM";
if (hours > 12) { dn = "PM"; hours = hours - 12; }
if (hours == 0) { hours = 12; }
} else {
dn = "";
}
if (minutes <= 9) { minutes = "0"+minutes; }
if (seconds <= 9) { seconds = "0"+seconds; }
myclock = hours+':'+minutes+':'+seconds+' '+dn;
document.kee.time.value = myclock;
setTimeout("show_clock()",1000);
}
function show_date()
{
today = new Date () ;
Year=today.getYear();
if (Year < 1000)
Year+=1900 + 543
Date=today.getDate();
document.kee.date.value = Date + "/" + today.getMonth()+"/"+Year+""
}
</script>
|
then , I used
"<BODY onLoad="show_clock(), show_date()">". It makes the clock textfield don't increase the time. How can I fix them ?
Thank you
Kee