I have an ASP.Net page that has two text box controls on it. One if to collect an email address, and the other to collect a home airport code.
When the page loads, in the text boxes, I want to have appear "Enter e-mail address" and "Enter Airport Code", respectively. I've set the Text property of the text boxes to show this, of course. However some javascript I'm using is creating behaviors that isn't quite right.
In the textbox's onfocus event, I have "this.value=''" which works properly, but I do not want it to fire off on page load because it is clearing out the first of the two text boxes I have. The only other control I have on this page is a submit button, and in my code I placed btnSignup.Focus(), but that button is not receiving focus on Page Load. So this method isn't quite right.
The behavior I am after is, after page load and the text boxes display their initial values, if the user types something other than the default value in either of the text boxes, I dont want the text to be cleared if the textbox gains focus again; otherwise, if a text box gains focus and the text in the box equals the initial values, I want them cleared.
Any help and direction to some web sources would be great. I've searched Google but I don't think I'm searching the proper term because I'm not finding anything useful. As always, thank you for the help in advance!
When the page loads, in the text boxes, I want to have appear "Enter e-mail address" and "Enter Airport Code", respectively. I've set the Text property of the text boxes to show this, of course. However some javascript I'm using is creating behaviors that isn't quite right.
In the textbox's onfocus event, I have "this.value=''" which works properly, but I do not want it to fire off on page load because it is clearing out the first of the two text boxes I have. The only other control I have on this page is a submit button, and in my code I placed btnSignup.Focus(), but that button is not receiving focus on Page Load. So this method isn't quite right.
The behavior I am after is, after page load and the text boxes display their initial values, if the user types something other than the default value in either of the text boxes, I dont want the text to be cleared if the textbox gains focus again; otherwise, if a text box gains focus and the text in the box equals the initial values, I want them cleared.
Any help and direction to some web sources would be great. I've searched Google but I don't think I'm searching the proper term because I'm not finding anything useful. As always, thank you for the help in advance!