hi,
<br />
function totalMark()<br />
{<br />
var total=$get('txtSub1').value+$get('txtSub2').value+...;<br />
var percentage=total/(totalmarks)*100;<br />
$get('txtGrandTotal').value=total;<br />
$get('txtPercentage').value=percentage;<br />
}<br />
I hope this may help you