<!DOCTYPE html>
< html>
< head>
< meta charset = " UTF-8" >
< title> 日期</ title>
< SCRIPT language = " JavaScript" >
var handle;
function func ( x) {
clearInterval ( handle) ;
var p = new Date ( ) ;
document. myform. myclock. value = ( 1900 + p. getYear ( ) ) + "年" + ( p. getMonth ( ) + 1 ) + "月" + p. getDate ( ) + "日" ;
}
function func2 ( x) {
handle = setInterval ( "disptime()" , 1000 ) ;
}
function disptime ( ) {
var time = new Date ( ) ;
var hour = time. getHours ( ) ;
var minute = time. getMinutes ( ) ;
var second = time. getSeconds ( ) ;
var apm = "AM" ;
if ( hour > 12 ) {
hour = hour - 12 ;
apm = "PM" ;
}
if ( minute < 10 )
minute = "0" + minute;
if ( second < 10 )
second = "0" + second;
document. myform. myclock. value = hour + ":" + minute + ":" + second + " " + apm;
}
</ SCRIPT>
</ head>
< body>
< form name = " myform" >
< input name = " myclock" onmouseover = " func(this)" onmouseout = " func2(this)" type = " text" value = " " >
</ form>
</ body>
</ html>