hi i am new to web developing and i am working on a project which has a sale form with autoincrement rows with calculation part in it ,
the problem is when i execute it in browser the calculation part works for the first row
here's my code which can help u in understanding much better

<?php $ctr= ''; ?>
<html>
<title>Sale Entry</title>
<head>

</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" type="text/javascript"></script>
<script>
function calculateText(){

var op1=document.getElementById('qty');

var op2=document.getElementById('rate');

var result=document.getElementById('amount');

var subtot=document.getElementById('subtot');

var disc=document.getElementById('disc');

var vat=document.getElementById('vat');

var packing=document.getElementById('packing');

var billamt=document.getElementById('billamt');

if(op1.value=="" || op1.value!=parseFloat(op1.value)) op1.value=0;

if(op2.value=="" || op2.value!=parseFloat(op2.value)) op2.value=0;

result.value=0;

result.value=parseInt(result.value);

result.value=parseInt(result.value)+parseInt(op1.value)*parseInt(op2.value);

subtot.value =parseInt(result.value);

if(subtot.value=="" || subtot.value!=parseFloat(subtot.value)) subtot.value=0;

if(disc.value=="" || disc.value!=parseFloat(disc.value)) disc.value=0;

if(vat.value=="" || vat.value!=parseFloat(vat.value)) vat.value=0;

if(packing.value=="" || packing.value!=parseFloat(packing.value)) packing.value=0;

billamt.value=0;

billamt.value=parseInt(billamt.value);
billamt.value=parseInt(billamt.value)+parseInt(subtot.value)-parseInt(disc.value)+parseInt(vat.value)+parseInt(packing.value);

}

$(function(){
// sets the click function to everything with a class of add-field, this is useful if you want multiple add buttons such as plus signs
$(".add-field").click(function(){
// selects everything with a value of foo for the name attribute and adds the input after that selection
$("input[id='srno'][type='text'][name='srno']").after('<br /><input name="srno" type="text" size="4"/>');
$("input[id='itemcode'][name='itemcode']").after('<br /><input name="itemcode" type="text" size="6" />');
$("input[id='itemname'][name='itemname']").after('<br /><input name="itemname" type="text" size="35" />');
$("input[id='qty'][name='qty'][onblur='calculateText()']").after('<br /><input type="text" id="qty" name="qty" size="3" onblur="calculateText()" />');
$("input[id='rate'][name='rate'][onblur='calculateText()']").after('<br /><input type="text" id="rate" name="rate" onblur="calculateText()" size="6"/>');
$("input[id='amount'][name='amount'][onblur='calculateText()']").after('<br /><input type="text" id="amount" name="amount" onblur="calculateText()" readonly="readonly" size="8"/>');
return false;
});
});




</script>





</head>
<body>
<center><b><font size="4" color="green">SALE FORM</b></font></center>
<form name="sale" action="" method="Post">
<table align="center" width="750" Border="0px">
<tr>
<input type="hidden" name="vouchno" value=""/>
</tr>
<tr>
<td align="left">Party Name</td><td align="left"><select name="cmbname" style ="width:50% ;" tabindex="1"/>
<option value=""></option>
<?php
mysql_connect("localhost","root",'')or die(mysql_error());
mysql_select_db("customer") or die(mysql_error());
$result = mysql_query("SELECT DISTINCT `name` from `customer` order by accode") or die(mysql_error());


while ($name = mysql_fetch_array($result)){
echo "<option value='$name[name]'>$name[name]</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align="left">Invoice No.</td><td align="left"><input type="text" align="left" size="10" name="invno" value="" tabindex="2" /></td>
</tr>
<tr>
<td align="left">Type.</td><td align="left"><select align="left" name="cmbtype" style="width:15% ;" tabindex="3" />
<option value=""></option>
<option value="CASH">CASH</option>
<option value="CREDIT">CREDIT</option>
</select>
</td>
</tr>
<tr>
<table id="itemdtl" >
<tr>
<b><font size="4" color="green">Item Detail</b></font></tr>
<tr><td align="left">Srno.</td><td align="left">Item Code</td><td align="left">Item Name</td><td align="left">Qty</td><td></td><td align="left">Rate</td><td></td><td align="left">Amount</td>
</tr>
<tr>
<td align="left"><input type="text" id="srno" name="srno" size="4" tabindex="4" /></td><td><input type="text" id="itemcode" name="itemcode" size="6" tabindex="5" /></td><td><input type="text" id="itemname" name="itemname" size="35" tabindex="6" /></td>
<td><input type="text" name="qty" id="qty" size="3" onblur="calculateText()" tabindex="7" /></td><td>X</td><td><input type="text" id="rate" name="rate" onblur="calculateText()" size="6" tabindex="8" /></td><td>=</td><td><input type="text" id="amount" name="amount" onblur="calculateText()" readonly="readonly" size="8" tabindex="9" /></td>
<td><a class="add-field" href="#" tabindex="10">Add Field</a></td>
</tr>

<tr><br /></tr>
</tr>

<tr>
<td align="left">Sub Total</td><td align="left"><input type="text" name="subtot" size="12" onblur="calculateText()" id="subtot" readonly="readonly"/></td>
</tr>
<tr><td align="left">Less Dicount</td><td align="left"><input type="text" name="disc" size="12" id="disc" onblur="calculateText()" tabindex="11" /></td></tr>
<tr>
<td align="left">Add V.A.T</td><td align="left"><input type="text" name="vat" size="12" id="vat" onblur="calculateText()" tabindex="12"/></td>
</tr>
<tr>
<td align="left">Add Packing</td><td align="left"><input type="text" name="pack" size="12" id="packing" onblur="calculateText()" tabindex="13"/></td>
</tr>
<tr>
<td align="left">Net Amount</td><td align="left"><input type="text" name="netamt" size="18" id="billamt" onblur="calculateText()" readonly="readonly"/></td>
</tr>
</tr>

</tr>
</table>
</table>

</form>

</body>
</html>