js 倒计时功能

                                                                                                   **倒计时功能**

直接上代码喽
案例1
<!doctype html>

简单易用的倒计时js代码
00天 00时 00分 00秒

}
setInterval(GetRTime,0);

![在这里插入图片描述](https://img-blog.csdn.net/20181016162904307?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTg2NTQ2OQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70) 案例2 在倒计时中获取距离结束的时间戳 function timer(intDiff){ window.setInterval(function(){ var day1=0, hour1=0, minute1=0, second1=0;//时间默认值 if(intDiff > 0){
		day1=Math.floor(intDiff/1000/60/60/24);
		hour1=Math.floor(intDiff/1000/60/60%24)+day1*24;
		minute1=Math.floor(intDiff/1000/60%60);
		second1=Math.floor(intDiff/1000%60);

	}
	$('.hour_show').html('<s class="h"></s>'+hour1+':');
	$('.minute_show').html('<s></s>'+minute1+':');
	$('.second_show').html('<s></s>'+second1);
	intDiff = intDiff-1000;
	}, 1000);

}
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_41865469/article/details/83090704