mcallaghan
IS-IT--Management
I have a simple little form wearing i am trying to add 2 txtbox values and put it in a 3rd textbox. When the value change the third box will change. Can anyone explain what I am doing wrong.
Thanks for all your help.
<script type="text/javascript" language="javascript">
function calcVals()
{
var r = document.getElementById("JanSpendTextBox").value;
var r = document.getElementById("JanTaxTextBox").value;
var grandTotal = r + m;
document.getElementById("JanTotalTextBox").value=grandTotal;
}
</script>
<form id="form1" name="form1" runat=server method="post" action="" >
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DefaultMode="Insert"
Width="320px">
<InsertItemTemplate>
JanSpend:
<asp:TextBox ID="JanSpendTextBox" runat="server" onkeyup="javascript:calcVals();" Text='<%# Bind("JanSpend") %>'></asp:TextBox><br />
JanTax:
<asp:TextBox ID="JanTaxTextBox" runat="server" onkeyup="javascript:calcVals();" Text='<%# Bind("JanTax") %>'></asp:TextBox><br />
JanTotal: <asp:TextBox ID="JanTotalTextBox" runat="server" autopostback="true" Text='<%# Bind("JanTotal") %>'></asp:TextBox> <br />
Thanks for all your help.
<script type="text/javascript" language="javascript">
function calcVals()
{
var r = document.getElementById("JanSpendTextBox").value;
var r = document.getElementById("JanTaxTextBox").value;
var grandTotal = r + m;
document.getElementById("JanTotalTextBox").value=grandTotal;
}
</script>
<form id="form1" name="form1" runat=server method="post" action="" >
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1" DefaultMode="Insert"
Width="320px">
<InsertItemTemplate>
JanSpend:
<asp:TextBox ID="JanSpendTextBox" runat="server" onkeyup="javascript:calcVals();" Text='<%# Bind("JanSpend") %>'></asp:TextBox><br />
JanTax:
<asp:TextBox ID="JanTaxTextBox" runat="server" onkeyup="javascript:calcVals();" Text='<%# Bind("JanTax") %>'></asp:TextBox><br />
JanTotal: <asp:TextBox ID="JanTotalTextBox" runat="server" autopostback="true" Text='<%# Bind("JanTotal") %>'></asp:TextBox> <br />