<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户端js获得毫秒</title>
<script>
/*客户端js获得毫秒 - start*/
var d, s = "";
var c = ":";
d = new Date();
s += ((d.getYear()<1900) ? (1900+d.getYear()) : d.getYear())+ "/";
s += (d.getMonth() + 1) + "/";
s += d.getDate() + " ";
s += d.getHours() + c;
s += d.getMinutes() + c;
s += d.getSeconds() + c;
s += d.getMilliseconds();
alert(s);
document.write(s);
/*客户端js获得毫秒 - end*/
</script>
<script type="text/javascript">
/*页面动态获得时间 - start*/
function todaydatetime() {
var Time = new Date();
var year = Time.getYear();
var month = Time.getMonth() + 1;
var day = Time.getDate();
var hour = Time.getHours();
var minute = Time.getMinutes();
var second = Time.getSeconds();
return timedate= year + "\年" + month + "\月" + day + "\日" + " " + hour + ":" + minute + ":" + second;
}
</script>
<script type="text/javascript">
function ShowDatetime()
{
var times = todaydatetime();
var divid = document.getElementById("nowtime");
divid.innerHTML = times;
setTimeout('ShowDatetime();',1000);
}
</script>
</head>
<body οnlοad="ShowDatetime();">
<div id="nowtime"></div>
<!--页面动态获得时间 - end-->
</body>
</html>