<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>时钟例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript">
function clock() {
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth();
var day = today.getDate();
var hour = today.getHours();
var mini = today.getMinutes();
var sec = today.getSeconds();
document.getElementById('clock').value = ( year + " " + (month+1) + " " +day + " " + hour + ':' + mini + ':' + sec);
}
</script>
<style type="text/css">
</style>
</head>
<body>
<input type="text" id="clock" />
<script type="text/javascript">
setInterval('clock()',1000); //
</script>
</body>
</html>
时钟例子~!!
最新推荐文章于 2021-05-26 20:37:32 发布