i need to calculate sum of values of all text boxes.But i'm using onclick function for those text boxes.
let me explain it to you further.
here is my code:
Code: Select all
<tr>
<td width="100">Charges</td>
<td><input name="txt_pr" type="text" id="txt_pr" value="" size="10" maxlength="10" /></td>
<td><input name="txt_lf" type="text" id="txt_lf" value="" size="10" maxlength="20" /></td>
<td><input name="txt_lf" type="text" id="txt_lf" value="" size="10" maxlength="20" onClick="this.value=calcTot(document.getElementById('txt_pr').value,document.getElementById('txt_lf').value)" /></td>
</tr>Function is pasted below:
Code: Select all
<script>
function calcTot(qty,unitp)
{
var tot=0;
tot=parseFloat(qty)*parseFloat(unitp)*parseFloat(rate);
return tot;
}
</script>1st question:
Can i do that using onchange function?
if can, how it can be done?
2nd question:
How should i get sum of all text boxes that i used in my page?.i'm using 35 text boxes in my page.
Hope that everyone understood my problem.Can anyone help me to solve this matter?
Thanks in advance....