Breaking Posts

6/trending/recent
Type Here to Get Search Results !

onclick random number generate 0 lose or 1win in javascript

index.html

-----------------------------------Below code -----------------------------------------------------------











If You lose result lose 




If You win result win 



check live website - https://bit.ly/3H2yGxi

 <!DOCTYPE html>

 <html lang="en">

 <head>

  <meta charset="UTF-8">

  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Document</title>

  <script src="timer.js"></script> 

<script

  src="https://code.jquery.com/jquery-3.6.1.min.js"

  integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ="

  crossorigin="anonymous"></script>

  <script

  src="http://code.jquery.com/jquery-1.10.1.min.js"></script>


  <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>


  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

 </script>

 </head>

 <body>

 <h1 id="countdown"></h1>

 <h1 id="result"></h1>

  <div id= "startButtons">

    <input type="button" id="gameStart" value="start Time" onclick="ImageHosting_Click()"/> 

    <!-- <button  id= "gameStart" >Get Going!</button> -->

  </div>

  

 </body>

 </html>

 



Javascript 

timer.js

-----------------------------------Below code -----------------------------------------------------------

function ImageHosting_Click() {

    $("#startButtons").click(function () {

        var timeleft = 5;  

        var downloadTimer = setInterval(function function1(){       

        document.getElementById("countdown").innerHTML = timeleft + 

        "&nbsp"+"seconds remaining";


        timeleft -= 1;

        if(timeleft <= 0){

           

            clearInterval(downloadTimer);

 

            document.getElementById("countdown").innerHTML = "Time is up!";

             let gamess = Math.floor(Math.random() * 2);

            

             document.getElementById("result").innerHTML = gamess;  

             if(gamess == 0){


                document.getElementById("result").innerHTML = "you lose";  

              }else{

                document.getElementById("result").innerHTML = "you win";  

              }

        }

         

        }, 1000); 

       

    });

}

  Start your web developement Jurney 

Download from india click here -Downlaod

Download from Other country click here - Downlaod



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.