Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>kliknij kurwa pole</title>
- <style>
- body{
- margin:0px;
- padding:0px;
- }
- #container{
- background-color:LightBlue;
- height:700px;
- width:1000px;
- padding:50px;
- border:3px solid black;
- border-radius:10px;
- margin-left:200px;
- margin-top:50px;
- }
- #plansza{
- background-color:White;
- height:500px;
- border:3px solid black;
- width:500px;
- float:left;
- }
- #dodatkowe{
- float:right;
- }
- .pole{
- height:98px;
- width:98px;
- border:1px solid black;
- background-color:Blue;
- float:left;
- }
- #pole_dobre{
- background-color:Green;
- height:98px;
- width:98px;
- border:1px solid black;
- float:left;
- }
- </style>
- <script>
- var score=(-1);
- function reset(){
- score=(-1);
- }
- function wypelnij(){
- score++;
- var losowa = parseInt(Math.random() * 25);
- var content='';
- for(k=0;k<25;k++){
- if(k==losowa){
- content= content + '<div id="pole_dobre" onclick="wypelnij()"></div> ';
- }else{
- content = content + '<div class="pole"></div> ';
- }
- }
- console.log(score);
- document.getElementById('plansza').innerHTML=content;
- document.getElementById('wynik').innerHTML=score;
- }
- function czas(){
- var i=21;
- const time = setInterval(function() {
- i--;
- console.log(i);
- document.getElementById('zegar').innerHTML = i;
- if (i == 0) {
- clearInterval(time);
- document.getElementById('plansza').innerHTML = '<h1>Twój wynik to:'+score+'</h1><br><h1 onclick="czas();reset();wypelnij()">Aby rozpocząć ponownie kliknij na napis</h1>';
- }
- }, 1000);
- }
- </script>
- </head>
- <body>
- <div id="container">
- <div id="plansza">
- <h1 onclick="czas(); wypelnij()">ABY ROZPOCZĄĆ GRE KLIKNIJ NA NAPIS</h1>
- </div>
- <div id="dodatkowe">
- <h1>ZASADY GRY</h1> <br>
- "kliknij jak najwięcej razy w zielony kwadracik :)" <br>
- Czas : <span id="zegar"></span> <br>
- Wynik: <span id="wynik"></span> <br>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment