Mehram says:
onchanged=
"myFunction(this)"
The event handler for TextBox should be onchange instead of onchanged.
<asp:TextBox ID="txtPayingNow" onchange="myFunction(this)" runat="server" Width="25%"
CssClass="floattext img-rounded" Style="text-align: right;"></asp:TextBox>
And to assign value to TextBox using value property instead of innerHTML.
Refer updated code.
HTML
<div>
Available Months<asp:TextBox ID="txtAvailableMonths" runat="server"></asp:TextBox>
<br />
Amount<asp:TextBox ID="txtAmount" runat="server"></asp:TextBox>
<br />
Paying Now<asp:TextBox ID="txtPayingNow" onchange="myFunction(this)" runat="server"></asp:TextBox>
<br />
Debit<asp:TextBox ID="txtDebit" runat="server"></asp:TextBox>
</div>
<script type="text/javascript">
function myFunction(txt) {
var first = document.getElementById('txtAvailableMonths').value;
var second = document.getElementById('txtAmount').value;
var third = txt.value;
if (parseFloat(third) > parseFloat(first)) {
alert('Your Selected Months Is Greater Than To The Available Monthd');
} else {
document.getElementById("txtDebit").value = parseFloat(second) * parseFloat(third);
}
}
</script>
Screenshot