Hi all,
pls help me as i have been stuck for the past 4 days with the number alone text box that i am using in my asp.net web design.
I need to alert the user once the focus of this txtbox is lost, with a msg box.
I am using C# and my javascript code is:
function CheckValue()
{
if (isNaN(document .getElementById ("txtNumber" ))
{
alert("Please enter numeric values only.");
return false;
}
}
I tried to get the id of the txtbox using
alert(document. getElementById( "txtNumber" ));
But the alert shows null. How do i pass the control to the javascript function?
my asp.net code is :
<asp:TextBox ID="txtNumber" runat="server"
Width="31px" ToolTip="1 to 100 - numbers only" MaxLength="3" ></asp:TextBox>
my C# code in the Page is :
protected void Page_Load(objec t sender, EventArgs e)
{
txtNumber.Attri butes.Add("onbl ur", "CheckValue();" );
}
Please help...
pls help me as i have been stuck for the past 4 days with the number alone text box that i am using in my asp.net web design.
I need to alert the user once the focus of this txtbox is lost, with a msg box.
I am using C# and my javascript code is:
function CheckValue()
{
if (isNaN(document .getElementById ("txtNumber" ))
{
alert("Please enter numeric values only.");
return false;
}
}
I tried to get the id of the txtbox using
alert(document. getElementById( "txtNumber" ));
But the alert shows null. How do i pass the control to the javascript function?
my asp.net code is :
<asp:TextBox ID="txtNumber" runat="server"
Width="31px" ToolTip="1 to 100 - numbers only" MaxLength="3" ></asp:TextBox>
my C# code in the Page is :
protected void Page_Load(objec t sender, EventArgs e)
{
txtNumber.Attri butes.Add("onbl ur", "CheckValue();" );
}
Please help...
Comment