HTMLify

Grade's Calculator
Views: 182 | Author: ahmads_codes
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <link rel="stylesheet" href="day10if_else_task.css"> -->
    <style>
        .g{

position: absolute;
top: 250px;
left: 30%;
height: 200px;
width: 30%;
border: 5px solid red;
animation-name: amaan;
animation-duration: 2s;
animation-delay: 2s;
animation-iteration-count: infinite;

}
@keyframes amaan{
0%{ background-color: green;}
25%{ background-color: red;}
75%{ background-color: yellow;}
50%{ background-color: blueviolet;}
100%{ background-color: orange;}
}

    </style>
    <script>
        function ch(){
        let a=parseFloat(document.getElementById("t1").value)
        let b=parseFloat(document.getElementById("t2").value)
        let c=parseFloat(document.getElementById("t3").value)
        let d=parseFloat(document.getElementById("t4").value)
        let e=parseFloat(document.getElementById("t5").value)
        f=(a+b+c+d+e)
        g=f/5
        document.getElementById("d1").innerHTML = f;
        document.getElementById("d1").innerHTML = g;

        if(a<33||b<33||c<33||d<33||e<33)
        {
            document.getElementById("d1").innerHTML="Fail"
        }
        else if(g>=33 && g<50)
        {
            document.getElementById("d1").innerHTML="Grade C"
        }
        else if(g>=50 && g<75)
        {
            document.getElementById("d1").innerHTML="Grade B"
        }
        else 
        {
            document.getElementById("d1").innerHTML="Grade A"
        }

    }


    
    </script>
</head>
<body>
    <div class="g"><center>
        <h1><b>👻Calculate Your Grade👻</b></h1>
    <input type="text" id="t1"><br>
    <input type="text" id="t2"><br>
    <input type="text" id="t3"><br>
    <input type="text" id="t4"><br>
    <input type="text" id="t5"><br>
    <input type="button" value="Enter"   onclick="ch()"><br>
    <h1 id="d1"></h1></center></div>
    <img src="report.webp" alt="" height="750px" width="100%">
    
</body>
</html>

Comments