<script language="javascript">
function fnccal(){
var sum =0;
var tot =0;
for(i=0;i<document.form1.cnt.value;i++){
sum=parseFloat(eval("document.form1.amount"+i+".value"))*parseFloat(eval("document.form1.price_per_unit"+i+".value"));
document.form1.sum[i].value=sum;
tot=tot+sum;
document.form1.total_price.value=tot;
}
}
</script>