-
Notifications
You must be signed in to change notification settings - Fork 0
/
p8.html
64 lines (63 loc) · 1.91 KB
/
p8.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<html>
<head>
<title>Student Details Form</title>
<script type="text/javascript">
function computation()
{
var name=document.getElementById("name").value;
var cls =document.getElementById("class").value;
var course=document.getElementById("cors").value;
var marks1=parseInt(document.getElementById("sub1").value);
var marks2=parseInt(document.getElementById("sub2").value);
var marks3=parseInt(document.getElementById("sub3").value);
var total=marks1+marks2+marks3;
var avg=total/3;
var grade, result;
if (avg>60)
{
grade="A";
result="First Class";
}
else if(avg<=60&&avg>50)
{
grade="B";
result="Second Class";
}
else if(avg<=50&&avg>40)
{
grade="C";
result="Third Class";
}
else
{
grade="D";
result="Fail";
}
document.write("<h2><b>Student Report</b></h2>");
document.write("<b>Name :"+name+"</b><br/><br/>");
document.write("<b>Class :"+cls+"</b><br/><br/>");
document.write("<b>Course :"+course+"</b><br/><br/>");
document.write("<b>Subject1:"+marks1+"</b><br/><br/>");
document.write("<b>Subject2:"+marks2+"</b><br/><br/>");
document.write("<b>Subject3:"+marks3+"</b><br/><br/>");
document.write("<b>Total Mraks :"+total+"</b><br/><br/>");
document.write("<b>Average :"+avg+"</b><br/><br/>");
document.write("<b>Grade:"+grade+"</b><br/><br/>");
document.write("<b>Result:"+result+"</b><br/><br/>");
}
</script>
</head>
<form>
<table border='5'>
<tr><th>Student Details</th></tr>
<tr><td>Name :</td><td><input type="text" id="name"/></td></tr>
<tr><td>Class :</td><td><input type="text" id="class"/></td></tr>
<tr><td>Course :</td><td><input type="text" id="cors"/></td></tr>
<tr><td>Subject1 :</td><td><input type="text" id="sub1"/></td></tr>
<tr><td>Subject2 :</td><td><input type="text" id="sub2"/></td></tr>
<tr><td>Subject3:</td><td><input type="text" id="sub3"/></td></tr>
</table>
</br><input type"button" value="View Report" onclick="computation()"/>
</form>
</body>
</html>