模板:倒计时:修订间差异

来自新浪维基
跳转到导航 跳转到搜索
普通の魔法使
普通の魔法使留言 (创建页面,内容为“ var shijian=3600; var time=null; function start(){ time=setInterval("count()",1000); } function count(){ if(shijian<0){…”)
 
第1行: 第1行:
var shijian=3600;
<!doctype html>
     var time=null;
<html lang="en">
     function start(){
<head>
        time=setInterval("count()",1000);
     <meta charset="UTF-8">
     }
     <title>Document</title>
      
    <script src="1.js"></script>
    function count(){
     <script src="jquery-1.8.3.min.js"></script>
         if(shijian<0){
     <style type="text/css">
             alert("time out");
         input{
             pause();
             background-color: #9fc5f1;
        }else{
             width: 100px;  
             $("#time p").html(Math.floor(shijian/60)+":"+shijian%60);
            height: 30px;
             shijian--;
             line-height: 30px;  
             console.info(time);
             text-align: center;
            color: #fff;
            font-size:14px;  
             font-weight: bold;
         }
         }
     }
        #time p{
     function pause(){
            color: #1f6dc2;
        clearInterval(time);
            font-size: 48px;
     }
            font-weight: bold;
     function goOn(){
            margin-left:90px;
        time = setInterval("count()",1000);
            margin-bottom:0px;
    }
        }
     </style>
     <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<body>
<div id="time">
     <p>00:00</p>
     <input type="button" value="开始" onclick="start()"/>
    <input type="button" value="暂停" onclick="pause()"/>
    <input type="button" value="继续" onclick="goOn()"/>
</div>
</body>
</html>

2021年9月16日 (四) 11:49的版本

<!doctype html> <html lang="en"> <head>

   <meta charset="UTF-8">
   <title>Document</title>
   <script src="1.js"></script>
   <script src="jquery-1.8.3.min.js"></script>
   <style type="text/css">
       input{
           background-color: #9fc5f1;
           width: 100px; 
           height: 30px; 
           line-height: 30px; 
           text-align: center; 
           color: #fff; 
           font-size:14px; 
           font-weight: bold;
       }
       #time p{
           color: #1f6dc2;
           font-size: 48px; 
           font-weight: bold;
           margin-left:90px;
           margin-bottom:0px;
       }
   </style>
   <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<body>

00:00

   <input type="button" value="开始" onclick="start()"/>
   <input type="button" value="暂停" onclick="pause()"/>
   <input type="button" value="继续" onclick="goOn()"/>

</body> </html>