Advertisement
ph4x35ccb

contagem regressiva

Apr 27th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta charset="UTF-8"/>
  5.     <title>Coutdown</title>
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <link rel="stylesheet" type="text/css" href="style.css">
  8. </head>
  9. <body>
  10.    <p id="time">Countdown</p>
  11.    <img src="xm.png" alt="Countdown" id="fire" onclick="xequeMate()">
  12. <script src="arquivo.js"></script>
  13. </body>
  14. </html>
  15. @import url('https://fonts.googleapis.com/css?family=Orbitron');
  16. body{
  17.     font-family: 'Orbitron', sans-serif;
  18.     background-color: #07060a;
  19.     color: #ff0000;
  20.     font-size: 43px;
  21.     text-align: center;
  22. }
  23. #fire{
  24.     cursor: pointer;
  25. }
  26. img{
  27.     max-width: 100%;
  28. }
  29. var check = false;
  30. function xequeMate(){
  31.     if(check==false){
  32.         var timer1 = setInterval(function(){start()},1000);
  33.         var timer2 = setInterval(function(){end()},13200);
  34.         var count =10;
  35.         function start(){
  36.             soundBeep();
  37.             document.getElementById("time").innerHTML = count;
  38.             if(count==0){
  39.                 clearInterval(timer1);
  40.                 soundThunder();
  41.                 document.getElementById("fire").src="explosion.gif";
  42.                 document.getElementById("time").innerHTML = "GAME OVER";
  43.             }
  44.             count --;
  45.         }
  46.         check=true;
  47.     }
  48. }
  49. function soundThunder(){
  50.     var beep = new Audio();
  51.     beep.src="Thunder_Crack.mp3";
  52.     beep.play();
  53. }
  54. function soundBeep(){
  55.     var beep = new Audio();
  56.     beep.src="Beep_Short.mp3";
  57.     beep.play();
  58. }
  59. function end(){
  60.     document.getElementById("fire").src="clean.png";
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement