-
Notifications
You must be signed in to change notification settings - Fork 0
/
page1.html
90 lines (82 loc) · 1.97 KB
/
page1.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html>
<head>
<title></title>
<style>
body
{
background:lightblue;
}
label
{
width:150px;
display:inline-block;
text-align:left;
}
form
{
margin:25px auto;
padding:20px;
border:5px solid #ccc;
width:500px;
background:deepskyblue;
}
</style>
</head>
<body>
<br>
<center>
<h2>CO ATTAINMENT REPORT FOR COURSE</h2></center>
<br>
<form method="post">
<p>
<label><b>CO1:</b></label><br>
<label>ISE-I:</label>
<input type="number" name="ISE-I" id="ise1"/><br>
<br>
<label>ISE-II:</label>
<input type="number" name="ISE-II" id="ise2"/><br>
<br>
<label>MSE:</label>
<input type="number" name="MSE" id="mse"/><br>
<br>
<label>ESE</label>
<input type="number" name="ESE" id="ese"/><br>
<br>
<label>Class Average Target:</label>
<input type="number" name="Target" id="target"/>
<br>
<br>
<button type="button" onclick="getInputValue();">Calculate</button>
<br>
<p>Percentage CO Attainment:
<span id = "result"></span>
</p>
<script>
function getInputValue(){
// Selecting the input element and get its value
var a = document.getElementById("ise1").value;
var b = document.getElementById("ise2").value;
var c = document.getElementById("mse").value;
var d = document.getElementById("ese").value;
var e = parseInt(document.getElementById("target").value);
if(a == '' || a == null){a = 0};
if(b == '' || b == null){b = 0};
if(c == '' || c == null){c = 0};
if(d == '' || d == null){d = 0};
a = parseInt(a);
b = parseInt(b);
c = parseInt(c);
d = parseInt(d);
if (a >= 0 && a <= 100 && b >= 0 && b <= 100 && c >= 0 && c <= 100 && d >= 0 && d <= 100 && e >= 0 && e <= 100 )
{
document.getElementById("result").innerHTML = (Math.min( ((((a + b + c + d) / 4)/e)* 100), 100));
}
else
{
alert("Enter marks between 0-100");
}
}
</script>
</form>
</body>
</html>