.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Javascript >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Textbox Watermarker

Posted By:Sasi Prabhu       Posted Date: July 05, 2011    Points: 40    Category: Javascript    URL: http://www.dotnetspark.com  

Simple Javascript textbox watermarker in asp.net.
 



Add a javascript file:

Wirte the Function into Javascript :

function blur(obj) {
    var watermark=document.getElementById(obj);
    if (watermark.value == '')
        watermark.value = watermark.defaultValue;
}

function focus(obj) {
    var watermark=document.getElementById(obj);
    if (watermark.value == '')
        watermark.value = watermark.defaultValue;
}

In the Aspx Page :

Inside Tag link the JavaScript :

 
Inside Form Tag add the Text Box :





Now Press F5...




     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend