Saturday, March 1, 2014

How TO display Student Result Using Javascript


Source Code Of The Program
<html>
<head>
<script>
function mks()

{

var name1=document.form.name.value;
var roll1=document.form.roll.value;
var sc1=document.form.sc.value;
var math1=document.form.math.value;
var eng1=document.form.eng.value;

var marks=eval(parseInt(sc1)+parseInt(math1)+parseInt(eng1));
var per=eval((marks*100)/300);


/*document.getElementById('result').innerHTML="Name"+name1+"<br>Roll"+roll1+"<br>Science"+sc1+"<br>Math"+math1+"<br>English"+eng1+'<br>Marks Obtain'+marks+'<br>Percentage'+per;*/


//location.href='http://google.com';
document.getElementById('result').innerHTML='name:'+name1+"<br> Roll"+roll1+"<br>marks: "+marks+"<br>Percentage"+per;
}
</script>
</head>
<body>
<form name='form'>
name: <input type='text' name='name'><br>
Roll: <input type='text' name='roll'><br>
Science: <input type='text' name='sc'><br>
Math: <input type='text'name='math'><br>
English: <input type='text' name='eng'><br>

</form>
<div style="background:red; height:30px; width:80px;" onclick='javascript:mks()'>submit</div>
<div id='result'></div>
</body>
</html>





name:
Roll:
Science:
Math:
English:
submit