-
Accessing two objects at the same time
Hi there. I have a TextBox and a Label, in a ASP.NET + C# + JavaScript page.
The TextBox have a onKeyUp event, that calls the ValidateDate function (accepts only numbers):
C#:
TextBox.Attributes.Add("onKeyUp", "return ValidateDate (this)");
JavaScript:
function ValidateDate (txtBox) {
if ("0123456789".indexOf(txtBox.value.substr(txtBox.value.length-1, 1)) == -1)
txtBox.value = txtBox.value.substr(0, txtBox.value.length-1);
}
This code works fine, but I want more!! How do I do to, when the user types an incorrect character, a error text appears in my Label?
HTML:
<asp:TextBox id="TextBox" runat="server"></asp:TextBox>
<asp:Label id="Label" runat="server"></asp:Label>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks