html和js

<html>
<head>
    <meta charset="UTF-8">
<SCRIPT LANGUAGE="JavaScript">
var maxtime = 15*15 //半个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
minutes = Math.floor(maxtime/15);
seconds = Math.floor(maxtime%15);
msg = "距离结束还有"+minutes+""+seconds+"";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*15) alert('注意,还有5分钟!');
--maxtime;
}
else{
clearInterval(timer);
alert("时间到,结束!");
}
}
timer = setInterval("CountDown()",1000);

</SCRIPT>
<style>
    #timer{
        position: absolute;
        left:100px; height:100px;
    }
    
</style>
</head>
<body background="img/11141_03.jpg" style=" background-repeat:no-repeat ;

background-size:100% 100%; 

background-attachment: fixed;" >
<div id="timer" style="color:red"></div>
</body>
</html>

原文:乔兔兔HAPPYhttps://zhidao.baidu.com/question/548712347.html

posted @ 2018-12-11 14:54  我吗?  阅读(393)  评论(0编辑  收藏  举报