base15.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  7. <link rel="stylesheet" href="../style/weui.css"/>
  8. <link rel="stylesheet" href="../style/weui2.css"/>
  9. <link rel="stylesheet" href="../style/weui3.css"/>
  10. <script src="../zepto.min.js"></script>
  11. <script>
  12. $(function(){
  13. });
  14. var t =1136000000;//秒数
  15. function showtime(){
  16. var d = parseInt(t/3600/24);
  17. if(d<10){
  18. d="0"+d;
  19. }
  20. var h = parseInt((t%(3600*24))/3600);
  21. if(h<10){
  22. h="0"+h;
  23. }
  24. var m = parseInt((t%(3600*24))%3600/60);
  25. if(m<10){
  26. m="0"+m;
  27. }
  28. var s = parseInt((t%(3600*24))%60);
  29. if(s<10){
  30. s="0"+s;
  31. }
  32. var a=(d=="00")?"":'<span>'+d+' </span>天 ';
  33. var b=(h=="00")?"":'<span>'+ h+' </span> 时 ';
  34. var c=(m=="00")?"":'<span>'+m+' </span> 分 ';
  35. var d=(s=="00")?"":'<span>'+s+' </span> 秒';
  36. $('.countdown').html(a+b+c+d);
  37. t = t -1;
  38. }
  39. showtime();
  40. setInterval("showtime()",1000);
  41. </script>
  42. <style>
  43. .countdown{width:100%;color:#000;line-height: 20px;font-size:14px;}
  44. .countdown span{ background-color:rgba(0,0,0,0.5);color: #fff;padding:5px;border-radius: 2px;margin:10px;}
  45. </style>
  46. </head>
  47. <body ontouchstart style="background-color: #f8f8f8;">
  48. <div class="page-hd">
  49. <h1 class="page-hd-title">
  50. 倒计时
  51. </h1>
  52. <p class="page-hd-desc">倒计时css和js是独立的,参看本页,用在答题,需要计时游戏</p>
  53. </div>
  54. <div class="page-bd-15">
  55. <div class="countdown"></div>
  56. </div>
  57. </body>
  58. </html>