Marksheet code in JavaScript

<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
<script type = "text/javascript">
    function calc()
    {
        var m1,m2,m3,avg = 0,total = 0, result = "",grade = "";
        m1 = parseInt(document.form1.wp.value);
        m2 = parseInt(document.form1.sp.value);
        m3 = parseInt(document.form1.cg.value);
        total = m1+m2+m3;
        avg = total/3;
        if( m1 < 35 || m2 < 35 || m3 < 35)
        {
            result = "fail";
            grade = "D";
        }
        else if(avg >= 75)
        {
            result = "Distinction";
            grade = "A+";
        }
        else if(avg >= 60 && avg < 75)
        {
            result = "First class";
            grade = "A";
        }
        else if(avg >= 50 && avg < 60)
        {
            result = "Second class";
            grade = "B";
        }
        else if(avg >=35 && avg < 50)
        {
            result = "Pass class";
            grade = "C";
        }
        else  if (avg < 35)
        {
            result = "Fail";
            Grade = "D";
        }
        document.form1.result.value = result;
        document.form1.grade.value = grade;
        document.form1.total.value = total;
        document.form1.average.value = avg;
       
    }
</script>
</head>
<body>
    <form name = "form1">
        <table border = "1">
            <tr>
                <td> Student Name</td>
                <td><input type = "text"  /></td>
            </tr>
            <tr>
                <td colspan = "2" align = "center">Subject Marks</td>
            </tr>
            <tr>
                <td>Web Programming</td>
                <td><input type = "text" name = "wp" /></td>
            </tr>
            <tr>
                <td>Computer Graphics</td>
                <td><input type = "text" name = "cg" /></td>
            </tr>
            <tr>
                <td>System Programming</td>
                <td><input type = "text" name = "sp" /></td>

            </tr>
            <tr>
                <td colspan = "2" align = "center"><input type = "button"   onclick = "calc()" value = "calculte" /></td>
            </tr>           
            <tr>
                <td>Total</td>
                <td><input type = "text" name = "total"/></td>

            </tr>
            <tr>
                <td>Average</td>
                <td><input type = "text" name = "average" /></td>
            </tr>
            <tr>
                <td>Result</td>
                <td><input type = "text" name = "result" /></td>
            </tr>
            <tr>
                <td>Grade</td>
                <td><input type = "text" name = "grade"/></td>
            </tr>

        </table>
    </form>
</body>
</html>

How to show grades in JavaScript?

Live Demo:.
var students = [['David', 80], ['Vinoth', 77], ['Divya', 88], ['Ishitha', 95], ['Thomas', 68]]; ​ var Avgmarks = 0;.
for (var i=0; i < students. length; i++) { ... .
console. log("Average grade: " + (Avgmarks)/students. ... .
console. log("Grade : F"); ... .
console. log("Grade : D"); ... .
console. log("Grade : C");.

How to add marks in JavaScript?

// To add the marker to the map, call setMap(); marker. setMap(map);

How to display total marks in JavaScript?

In order to calculate the percentage of total marks, we have to divide the obtained marks by the total markes of the all subjects and then multiply by 100. ... Create Marks Input Fields..

How to store student details in Javascript?

You can simply add another level, like this: var students = localStorage. getItem("students"); if (students) { students = JSON.