2
回答
JavaSctipt年末倒计时
按年算一周期,倒计时  XX天XX小时,第二年重新倒计时。
<无标签>
举报
共有2个答案 最后回答: 5年前
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 </head>
 <body>
	<span id="time"></span>
	<script type="text/javascript">
	<!--
		setInterval(function(){
			var date = new Date(new Date().getFullYear() + "/12/31");
			var total = (date - new Date()) / ( 1000 * 60 * 60 );
			var hours = total % 24;
			var days = (total - hours) / 24
			var time = document.getElementById("time");
			time.innerHTML = days + "天" + hours.toFixed(2) + "小时";
		},1000)
	//-->
	</script>
 </body>
</html>
顶部