利用javascript在当前页面显示时间

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Constellation</title>
<script type="text/javascript">
function timer()
{
    var time=new Date();
    document.getElementById("currentTime").innerHTML="当前时间:"+time;
}
setInterval("timer()", 1000);
</script>
</head>
<body>
<div  id="currentTime">当前时间:时间载入中......</div>
<div>
</body>
</html>

posted @ 2014-10-19 00:09  honglei92  阅读(251)  评论(0编辑  收藏  举报