Q. Write a program to design a table and enter two numbers each of five students and when we click button "Result",it will give total marks and percentage of each student.
<html>
<head>
<script>
function f1()
{
t1=parseInt(document.ff.t1.value)
t2=parseInt(document.ff.t2.value)
t3=parseInt(document.ff.t3.value)
t4=parseInt(document.ff.t4.value)
t5=parseInt(document.ff.t5.value)
t6=parseInt(document.ff.t6.value)
t7=parseInt(document.ff.t7.value)
t8=parseInt(document.ff.t8.value)
t9=parseInt(document.ff.t9.value)
t10=parseInt(document.ff.t10.value)
tc1=t1+t2
tc2=t3+t4
tc3=t5+t6
tc4=t7+t8
tc5=t9+t10
to1=(t1+t2)/2
to2=(t3+t4)/2
to3=(t5+t6)/2
to4=(t7+t8)/2
to5=(t9+t10)/2
document.ff.tt1.value=tc1
document.ff.tt2.value=tc2
document.ff.tt3.value=tc3
document.ff.tt4.value=tc4
document.ff.tt5.value=tc5
document.ff.tr1.value=to1
document.ff.tr2.value=to2
document.ff.tr3.value=to3
document.ff.tr4.value=to4
document.ff.tr5.value=to5
}
</script>
</head>
<body>
<form name=ff>
<center><h1><b>RESULT</b></h1><br><table border=2 cellpadding=10>
<tr>
<th>S.No.
<th>Name
<th>DCAP 1
<th>DCAP 2
<th>Total
<th>Percent
</tr>
<tr>
<td>1
<td>Neha
<td><input type=textbox name=t1>
<td><input type=textbox name=t2>
<td><input type=textbox name=tt1>
<td><input type=textbox name=tr1>
</tr>
<tr>
<td>2
<td>Amit
<td><input type=textbox name=t3>
<td><input type=textbox name=t4>
<td><input type=textbox name=tt2>
<td><input type=textbox name=tr2>
</tr>
<tr>
<td>3
<td>Rahul
<td><input type=textbox name=t5>
<td><input type=textbox name=t6>
<td><input type=textbox name=tt3>
<td><input type=textbox name=tr3>
</tr>
<tr>
<td>4
<td>Rajat
<td><input type=textbox name=t7>
<td><input type=textbox name=t8>
<td><input type=textbox name=tt4>
<td><input type=textbox name=tr4>
</tr>
<tr>
<td>5
<td>Lalit
<td><input type=textbox name=t9>
<td><input type=textbox name=t10>
<td><input type=textbox name=tt5>
<td><input type=textbox name=tr5>
</tr>
</table><br>
<input type=button value=Result onClick="f1()"></center>
</body>
</html>
No comments:
Post a Comment