How do you autoclear the "initial value" of a textbox when a user clicks or tabs into the texbox?
If you have a textbox for "Enter Email Address: " and you put an intial value of "please enter your email address" in the textbox, how do you add javascript to clear this value for the "onfocus=" event (which covers clicks and tabs)?
Is adding a link to a small JS file with a clear() function and adding code to the aspx template the only way to handle this?
To ask the inverse:
How do you re-add your status message if the user clicks or tabs out of your field without entering anything? See pseudo-code below
<script type="text/javascript">
function yUNoHaveText() {
var myTextBox = document.getElementById('myTxtBox');
if(myTextBox.value == "")
myTextBox.value = "Please enter your email address"
}
</script>
<input type='text' id='myTxtBox' onblur='yUNoHaveText()' />
edit: i would've wrapped my code in <pre> tags if it were working....