温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

js实现-限时抢购倒计时间表

发布时间:2020-06-28 14:28:17 来源:网络 阅读:1874 作者:ljheee 栏目:开发技术
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>限时抢购倒计时间表</title>

<style type="text/css">
*{margin:0;padding:0;}
#content{width:300px;margin:0 auto;padding:10px;background:#eee;border:1px solid #999;}
#content p span{color:red;font:bold 20px Arial;}
#content p a{font:12px/23px '宋体';color:#888;}
.div1{ display:none;}
</style>

<SCRIPT LANGUAGE="JavaScript">
function fresh()
{
        var endtime=new Date("2110/11/06,12:20:12");
        var nowtime = new Date();
        var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
        d=parseInt(leftsecond/3600/24);
        h=parseInt((leftsecond/3600)%24);
        m=parseInt((leftsecond/60)%60);
        s=parseInt(leftsecond%60);
       
//        document.getElementById("times").innerHTML=__h+"小时"+__m+"分"+__s+"秒";
document.getElementById("times").innerHTML=h+"小时"+m+"分"+s+"秒";
        if(leftsecond<=0){
        	document.getElementById("times").innerHTML="已结束";
        	clearInterval(sh);
        }
}
var sh;
sh=setInterval(fresh,1000);
</SCRIPT>
</head>

<body>
<div id="content">
<h2>限时抢购啦!</h2>
<p>还剩<span id="times"></span></p>
</div>
</body>
</html>


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI