Friday, December 25, 2020

Lotto App|Random Number App|Javascript app

 Random Number App: In this tutorial you will make app similar to Lottery or pick 3 number app. It is fun way to make app . You will use HTML, CSS and JavaScript . In JavaScript you will use Random generator and DOM (Document Object Model). How these topics go to gather and by using Event what you make. Here is source code and video for it. 

Video:



Source Code: 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Lotto</title>
    <style>
        #container{
            height300px;
            width300px;
            bordersolid 2px black;
            text-aligncenter;

        }
        input{
            background-colorblue;
            colorwhite;
            height70px;
            width70px;
            text-aligncenter;
            font-size30px;
            font-weightbold;
        }
        button{
            height30px;
            width70px;
            margin-top20px;
            background-colorteal;
            border-radius20px;
            colorwhite;
            font-size15px;
            font-weightbold;

        }

    </style>
</head>
<body>
    <div id="container">
        <h1>Lotto Game:</h1>
        <input type="text" id ="one">
        <input type="text" id ="two">
        <input type="text" id ="three"><br>
        <button id ="submit">Click</button>

    </div>
   
    <script>
        var randonedocument.querySelector("#one")
        var randtwodocument.querySelector("#two")
       var randthreedocument.getElementById("three")
       var submit =document.getElementById("submit")
       submit.addEventListener("click"function(){
           numberone();
           numbertwo();
           numberthree();

           

       })
       function numberone(){
          randone.valueMath.floor(Math.random()*10)
       }
       function numbertwo(){
          randtwo.valueMath.floor(Math.random()*10)
       }
       function numberthree(){
          randthree.valueMath.floor(Math.random()*10)
       }

    </script>
    
</body>
</html>

java switch statement | Java Tutorial For Beginners

 Switch statement is alternative and more cleaner way to write code if we have more than two options. we can use else if, this is better way...