Hi,
I have tried this solution (http://bytes.com/topic/javascript/an...g-numbers-form) for new html file, which works fine, however when I use same code in file where I have several Div's one inside another, it do not call/take the numbers. Please let me know if you if I call the textbox values with reference to form_name or div_name.....
Here is the javascript
Thanks,
Jag
I have tried this solution (http://bytes.com/topic/javascript/an...g-numbers-form) for new html file, which works fine, however when I use same code in file where I have several Div's one inside another, it do not call/take the numbers. Please let me know if you if I call the textbox values with reference to form_name or div_name.....
Code:
<body Background ="Images/SoftBlue.jpg"> <div id="container"> <form name="umsForm" action="MonthlysalUpdate.php" method="POST"> <!-- ..................__> <div id="saldetails"> <table class="center"> <tr><td>Earnings :</td><td>Amount</td><td width = "20"></td><td>Deductions</td><td>Amount</td></tr> <tr><td>Basic :</td><td> <input type="text" name="basic" onchange="calculate();" value=<?php echo $basic; ?>></td><td width = "20"></td><td>GPF/NPS :</td><td><input type="text" name="basic" value=<?php echo $basic; ?>></td></tr> <tr><td>Grade Pay :</td><td> <input type="text" name="grade_pay" onchange="calculate();" value=<?php echo $gpay;?> ></td><td width = "20"></td><td>CGEIS :</td><td><input type="text" name="basic" value=<?php echo $row['ccc'];?>></td></tr> <tr><td>Special Pay :</td><td> <input type="text" name="special_pay" onchange="calculate();" value=<?php echo $special_pay;?> ></td><td width = "20"></td><td>CGHS :</td><td><input type="text" name="basic" value=<?php echo $row['cid'];?>></td></tr> <tr><td>Gross Earnings :</td><td><strong><input type="text" name="gross_earnings" disabled="disabled" value=<?php echo $total; ?> ></strong></td><td width = "20"></td><td>Gorss Deductions :</td><td><strong><input type="text" name="basic" disabled="disabled" value=<?php echo $basic; ?>></strong></td></tr> </div> </div> </form> </body>
Code:
<script>
function calculate(){
alert(document.umsForm.basic.value);
document.umsForm.gross_earnings.value = eval(document.umsForm.basic.value) + eval(document.umsForm.gpay.value) + .......;
}
</script>
Jag
Comment