jquery 动态时间
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript" src="jquery-1.4.4.min.js" ></script><%--浮出层js--%>
</head>
<body>
<form id="form1" runat="server">
<span id="time"></span>
<script type="text/javascript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
stopclock();
showtime();
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var timeValue = now.getYear()+1900+"-"+(now.getMonth()+1)+"-"+now.getDate()+" ";
timeValue += ((hours >23) ? hours - 24 :hours);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
$('#time').html(timeValue);
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
$(document).ready(function(){
startclock();
});
</script>
</form>
</body>
</html>

浙公网安备 33010602011771号