Thursday, May 19, 2011

onblur and onfocus-textbox

Onblur and Onfocus textchange
function myFocus(element) {
if (element.value == element.defaultValue) {
element.value = '';
}
}
function myBlur(element) {
if (element.value == '') {
element.value = element.defaultValue;
}
}

Define it like this
<asp:textbox id="txtname" runat="server" text="Enter Your Name" height="29px" onfocus="myFocus(this);" onblur="myBlur(this);">

No comments:

Post a Comment