17-10-2012, 08:12 PM
<html>
<head>
<title>Student Mark List</title>
</head>
<script language="javascript">
function total_1()
{
var m1=parseInt(document.form1.tamil.value);
var m2=parseInt(document.form1.english.value);
var m3=parseInt(document.form1.maths.value);
var m4=parseInt(document.form1.science.value);
var m5=parseInt(document.form1.social.value);
document.form1.total.value=m1+m2+m3+m4+m5;
}
function result_1()
{
var m1=parseInt(document.form1.tamil.value);
var m2=parseInt(document.form1.english.value);
var m3=parseInt(document.form1.maths.value);
var m4=parseInt(document.form1.science.value);
var m5=parseInt(document.form1.social.value);
if(m1>=35 && m2>=35 && m3>=35 && m4>=35 && m5>=35)
{
document.form1.result.value="pass";
}
else
{
document.form1.result.value="fail";
}
}
function disp()
{
document.write("<h1><center><u>STUDENT MARK
LIST</u></center></h1><table
border="0"><tr><td>Name:</td><td>"+document.form1.stuName.va
lue+"</td></tr><tr><td>No:</td><td>"+document.form1.stuNo.valu
e+"</td></tr><tr><td>Tamil:</td><td>"+document.form1.tamil.valu
e+"</td></tr><tr><td>English:</td><td>"+document.form1.english.v
alue+"</td></tr><tr><td>Maths:</td><td>"+document.form1.maths.
value+"</td></tr><tr><td>Science:</td><td>"+document.form1.scie
nce.value+"</td></tr><tr><td>Social</td><td>"+document.form1.so
cial.value+"</td></tr><tr><td>Total:</td><td>"+document.form1.tot
al.value+"</td></tr><tr><td>Result:</td><td>"+document.form1.res
ult.value+"</td></tr></table>");
}
</script>
<body><center><h1>Student Mark List</h1>
<form name="form1">
<table border="2">
<tr><td><label>Name</label></td><td><input type="text"
name="stuName"></td></tr>
<tr><td><label>No</label></td><td><input type="text"
name="stuNo"></td></tr>
<tr><td><label>Tamil</label></td><td><input type="text"
name="tamil"></td></tr>
<tr><td><label>English</label></td><td><input type="text"
name="english"></td></tr>
<tr><td><label>Maths</label></td><td><input type="text"
name="maths"></td></tr>
<tr><td><label>Science</label></td><td><input type="text"
name="science"></td></tr>
<tr><td><label>Social</label></td><td><input type="text"
name="social"></td></tr>
<tr><td><label>Total</label></td><td><input type="text"
name="total" ONFOCUS="total_1()"
ONFOCUS="result_1()"></td></tr>
<tr><td><label>Result</label></td><td><input type="text"
name="result"></td></tr>
<tr><td><input type="submit" name="s" value="Submit"
onclick="disp()"></td><td><input type="reset" name="r"
value="Reset"></tr>
</table>
</form>
</center>
</body>
</html>