Friday 18 November 2011

onblur event

OnBlur event. Sometimes you want to show default value in TextBox when it is empty.

Definition:
The onblur event occurs when an object loses focus.


Code:
Following the javascript.

<script type="text/javascript">
      function Blur(a)
     {
             if(a.value = = "")
                  a.value = a.defaultValue;
     }
</script>

HTML Code:

<input type="text" value="Email ID"  onblur="Blur(this)"  id="txtEmail" name="txtEmail" />

No comments:

Post a Comment