<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
var strTime, strDate;
function webClock()
{
var dNow = new Date();
var dHours = dNow.getHours();
var dMinutes = dNow.getMinutes();
var dSeconds = dNow.getSeconds();
strTime = dHours;
strTime += ((dMinutes<10) ? ":0" : ":") + dMinutes;
strTime += ((dSeconds<10) ? ":0" : ":") + dSeconds;
clock.time.value = strTime;
var dDate = dNow.getDate();
var dMonth = dNow.getMonth() + 1;
var dYear = dNow.getYear();
strDate = dMonth;
strDate += ((dDate<10) ? "/0" : "/") + dDate;
strDate += "/" + dYear;
clock.date.value = strDate;
setTimeout("webClock()",1000);
}
</SCRIPT>
<TITLE></TITLE>
</HEAD>
<BODY>
<FORM NAME="clock">
时间:<INPUT TYPE="TEXT" NAME="time" SIZE="10"><BR>
日期:<INPUT TYPE="TEXT" NAME="date" SIZE="10"><BR>
</FORM>
</BODY>
</HTML>
---------------------
【转载,仅作分享,侵删】
作者:如果东京不快乐
原文:https://blog.csdn.net/qq_41664272/article/details/88606608
版权声明:本文为博主原创文章,转载请附上博文链接!
|
|