Marksheet code in JavaScript




Registration Form

    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;
       
    }



   
       


           
               
               
           
           
               
           
           
               
               
           
           
               
               
           
           
               
               

           
           
               
                       
           
               
               

           
           
               
               
           
           
               
               
           
           
               
               
           

       
Student Name
Subject Marks
Web Programming
Computer Graphics
System Programming
Total
Average
Result
Grade

   

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.

Bài mới nhất

Chủ Đề