Currently working with ASP.NET 2.0.
My Entry Form contains various ASP.NET Server Controls, such as TextBoxes. I want to pass the value of a TextBox on the onBlur event. Here is an example of a TextBox code:
<asp:TextBox ID="txtTotalTw" Width="80px" runat="server" MaxLength="10" onBlur="isNumber(this.Value);"></asp:TextBox>
In the code-behind, I have included the following line:
txtTotalTw.Attributes.Add("onBlur", "javascript:isNumber(this.Value)");
The JavaScript function looks like this:
<script type="text/javascript" language="javascript">
function isNumber(n) {
alert(n);
return !isNaN(parseFloat(n)) && isFinite(n);
}
</script>
To test whether the value is being passed, I added alert(n)
. However, when triggering the onBlur
event, the alert message shows 'undefined'.
Any suggestions on how to resolve this issue?