Watermark in textbox using javascript


we are seen in so many websites like when we place our mouce pointer in textbox

it will show empty textbox… and when we take out mouse pointer it will show

textbox with text like “UserName” or “Searchhere”…

to make your textbox likethat…

write the following code

 

 

<asp:TextBox ID="TextBox1"
 runat="server"
 onblur="if(this.value == ''){ this.value = 'UserName';}" 
 onfocus="if(this.value == 'UserName'){this.value = '';}"
 Text="UserName"></asp:TextBox>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s