这篇文章主要为大家详细介绍了javascript实现倒计时时差效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了js倒计时时差效果的实现代码,供大家参考,具体内容如下
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>当前系统时间</title>
<link rel="stylesheet" href="style.css" />
<script language="javascript" type="text/javascript">
window.onload = function(){
showtime();
}
function checktime(i){ //补位处理
if(i<10){
i='0'+i;
}
return i;
}
function showtime(){
var now=new date();
var year= now.getfullyear();
var month= now.getmonth()+1;
var day= now.getdate();
var h= now.gethours();
var m= now.getminutes();
var s= now.getseconds();
m=checktime(m);
s=checktime(s);
var weekday=new array(7)
weekday[0]="星期日"
weekday[1]="星期一"
weekday[2]="星期二"
weekday[3]="星期三"
weekday[4]="星期四"
weekday[5]="星期五"
weekday[6]="星期六"
document.getelementbyid("show").innerhtml=""+year+"年"+month+"月"+day+"日 "+ ? +h+":"+m+":"+s;
t=settimeout('showtime()',500)
}
</script>
</head>
<body>
<p class="content1">
<p id="show">显示时间的位置</p>
</p>
</body>
</html>
以上就是javascript中倒计时时差效果的实现方法详解的详细内容。