Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

HTML_CSS_AND_Javascript mini project turning ON OFF Bulb || AJAY SHUKLA

The code for the Project of bulb switcing ON/OFF  is given below :-

<!--

    Author : Ajay Kumar Shukla

    Purpose : Project of bulb on/off .

-->

<html>

    <head>

        <title>Bulb project by ajay shukla</title>

        <style type="text/css">

            button

            {

                height: 85px;

                width: 135;

                font-size: 23;

                cursor: pointer;

                margin: 75;

                background-color: blueviolet;

            }

        </style>

        <script type="text/javascript">

            function light(value)

            {

                var img;

                if(value==0)

                {

                    img="off bulb.png"

                }

                else

                {

                    img="on bulb.png"

                }

                document.getElementById('bulb').src=img

            }

        </script>

    </head>

    <body>

        <center>

        <img src="off bulb.png" id="bulb">

        <br>

        <Button onclick="light(1)">ON</Button>

        <Button onclick="light(0)">OFF</Button>

        </center>

    </body>

</html>

Coding and Designing a Calculator with HTML, CSS, and JAVASCRIPT || Ajay Shukla

Code to design and coding a calculator is given below:-

<html>
    <!--
        Author : Ajay Kumar Shukla
        Purpose : Designing and coding a calculator using html, css, and javascript.
    -->
    <head>
        <title>Calculator coding by Ajay Shukla</title>
        <style>
            .button
            {
                height: 83px;
                width: 75px;
                font-size: 20;
                cursor: pointer;
                background-color: rgba(0,0,0,0.5);
                color: blanchedalmond;
            }
            .scr
            {
                height: 101;
                width: 330;
                font-size: 42;
            }
            .calc
            {
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translateX(-50%) translateY(-50%);
            }
        </style>
        <script type="text/javascript">
        function enter(num)
        {
            document.form.view.value=document.form.view.value+num;
        }
        function clean()
        {
            document.form.view.value=""
        }
        function equal()
        {
            var cal=document.form.view.value;
            if(cal)
            {
                document.form.view.value=eval(cal);
            }
        }
        </script>
    </head>
    <body>
        <div class="calc">
            <form name="form">
                <input type="text" class="scr" name="view" readonly>
            </form>
            <table border="3px">
                <tr>
                    <th colspan="2"><input style="width: 154;" type="button" class="button" value="CLEAR" onclick="clean()"></th>
                    <th><input type="button" class="button" value="+" onclick="enter('+')"></th>
                    <th><input type="button" class="button" value="-" onclick="enter('-')"></th>
                </tr>
                <tr>
                    <th><input type="button" class="button" value="1" onclick="enter(1)"></th>
                    <th><input type="button" class="button" value="2" onclick="enter(2)"></th>
                    <th><input type="button" class="button" value="3" onclick="enter(3)"></th>
                    <th><input type="button" class="button" value="*" onclick="enter('*')"></th>
                </tr>
                <tr>
                    <th><input type="button" class="button" value="4" onclick="enter(4)"></th>
                    <th><input type="button" class="button" value="5" onclick="enter(5)"></th>
                    <th><input type="button" class="button" value="6" onclick="enter(6)"></th>
                    <th><input type="button" class="button" value="/" onclick="enter('/')"></th>
                </tr>
                <tr>
                    <th><input type="button" class="button" value="7" onclick="enter(7)"></th>
                    <th><input type="button" class="button" value="8" onclick="enter(8)"></th>
                    <th><input type="button" class="button" value="9" onclick="enter(9)"></th>
                    <th rowspan="2"><input style="height: 170;" type="button" class="button" value="=" onclick="equal()"></th>
                </tr>
                <tr>
                    <th><input type="button" class="button" value="." onclick="enter('.')"></th>
                    <th colspan="2"><input style="width: 154;" type="button" class="button" value="0" onclick="enter(0)"></th>
                </tr>
            </table>

        </div>
    </body>
</html>




See the video for complete tutorial=============