Hi,
I am trying to figure out how to do a client-side calculation based on
textbox values, using asp.net, without performing a postback.
I have 2 textboxes...
<asp:textbox runat="server" CssClass="ddclass" ID="txtTotal"
onBlur="calculate()" />
<asp:textbox runat="server" CssClass="ddclass" ID="txtAmount" />
I have used the following Javascript code...
<SCRIPT TYPE="text/javascript">
<!--
function calculate() {
var Amount;
Amount = (document.forms["_ctl0"].elements[5].value * 0.075);
Amount = CovCom.toFixed(2);
document.forms["_ctl0"].elements[6].value = Amount;
};
-->
</script>
However, sometimes the element number changes, and calculation does not
occur. Is there a way of referring to the textbox ID's in the Javscript
code?
Has anyone performed client-side calculations in asp.net without
postback? Is there a better way than doing the above?
Appreciate any help!!
Thanks,
John.
*** Sent via Developersdex http://www.developersdex.com ***