Task β SSLC Marks Total
<html>
<head>
<title> SSLC Marks </title>
<style>
body
{
background-color:black;
color:pink;
font-family:arial;
}
h1
{
text-align:center;
color:pink;
font-variant:small-caps;
}
th {
background-color:pink;
color:black;
font-size: 20px;
font-variant:small-caps;
}
.inputTxt{
color:black;
background-color:lightgrey;
border:green 2px solid;
padding-left:10px;
width:170px;
height:30px;
font-size:20px;
font-family:"Arial";
}
.lbl {
padding:25px;
font-weight:bold;
}
.button {
background-color:lightgrey;
color: black;
border:2px solid pink;
border-radius:15px;
font-size: 15px;
vertical-align:9px;
font-family:"sans-serief";
font-variant:small-caps;
font-weight:bold;
width:170px;
height:30px;
text-align:center;
}
.output {
font-family:"Arial";
font-size:20px;
font-weight:bold;
padding-left:25px;
}
</style>
</head>
<body>
<h1> SSLC Marks </h1>
<table border="1" align=center>
<thead>
<th>Subjects</th> <th>Marks</th>
</thead>
<tbody>
<form id="frmMarks">
<tr>
<td > <label for = "idTamil" class="lbl"> Tamil</label> </td>
<td> <input type="text" name="txtTamil" id="idTamil" class="inputTxt"> </td>
</tr>
<tr>
<td> <label for = "idEng" class="lbl"> English</label> </td>
<td> <input type="text" name="txtEng" id="idEng" class="inputTxt"> </td>
</tr>
<tr>
<td> <label for = "idMath" class="lbl"> Maths</label> </td>
<td> <input type="text" name="txtMath" id="idMath" class="inputTxt"> </td>
</tr>
<tr>
<td> <label for = "idSci" class="lbl"> Science</label> </td>
<td> <input type="text" name="txtSci" id="idSci" class="inputTxt"> </td>
</tr>
<tr>
<td> <label for = "idSS" class="lbl"> Social Science</label> </td>
<td> <input type="text" name="txtSS" id="idSS" class="inputTxt"> </td>
</tr>
<tr><td></td></tr<tr><td></td></tr>
<tr>
<td> <label for = "idTot" class="output">Total Marks</label> </td>
<td align="center"><output name="totMarks" id="idTot" class="output" form="frmMarks"></output</td>
</tr>
<tr>
<td > <label for = "idPercent" class="output">Percentage %</label> </td>
<td align="center"><output name="percent" id="idPercent" class="output" form="frmMarks"></output</td>
</tr>
</tbody>
</table>
<br><br>
<div align="center">
<input type="button" value="CLEAR" class="button" onclick="doClear()">
<input type="button" value="CALC TOTAL & %" class="button" onclick="calcTot()">
</div>
</form>
</body>
<script>
function calcTot() {
const tot = parseInt(document.querySelector("#idTamil").value) + parseInt(document.querySelector("#idEng").value) + parseInt(document.querySelector("#idMath").value) + parseInt(document.querySelector("#idSci").value) + parseInt(document.querySelector("#idSS").value);
document.querySelector("#idTot").innerHTML = tot;
alert(tot/5);
document.getElementById("idPercent").innerHTML = Math.round((tot/5)*100)/100+"%";
}
function doClear() {
document.querySelector("#frmMarks").reset();
document.querySelector("#idTot").innerHTML="";
document.getElementById("idPercent").innerHTML="";
}
</script>
</hmtl>
Output: