469,613 Members | 1,874 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

How to Display Text in TextBox in Web Application

16
Hi

Pls Any One Solve My Problem.

One Text box for Enter user Name.My Requirement is if web application is Run then, In Textbox Display "Pls Enter User name" If Click By Mouse the text Is Gone.If Enter Usename, If In Case Do Not Enter User Name, Again Come And Display "Pls Enter User Name"


Thanks & Regards
Atul Singh
Sep 21 '07 #1
4 1478
Hi

Pls Any One Solve My Problem.

One Text box for Enter user Name.My Requirement is if web application is Run then, In Textbox Display "Pls Enter User name" If Click By Mouse the text Is Gone.If Enter Usename, If In Case Do Not Enter User Name, Again Come And Display "Pls Enter User Name"


Thanks & Regards
Atul Singh
hi Atul u do this work on pageload.....by default enter "Pls Enter User name" 'd by jusing javascript on mouseclick event of textbox jst clear it 'd write whatever u want to write....'d then i suppose there is submit event on this check that textbox contents if it is equalt to ur "Pls Enter User name" this then send message enter correct username 'd tell me this help u or not


enjoy coding.....
Navneet
Sep 21 '07 #2
singh79
16
Ok,

I Agree With u...

But How ,Pls Give Me Code And How To Call Java Script In Page Load..

Full Code.Any One Display.....

Pls Help Me..
Regards
Atul Singh
Sep 24 '07 #3
krris
10
Textbox :
<asp:TextBox ID="txtFirstName" runat="server" CssClass="h_flattxt" Width="99px" onblur="DisplayMsg(this)" onfocus="DisplayMsg(this);">FirstName</asp:TextBox>



Code for javascript
in function DisplayMsg(TxtName)
if(TxtName.value.length > 0)
{
if(TxtName.value != 'FirstName' && TxtName.value.length > 0)
{
TxtName.value = TxtName.value;
TxtName.className = 'flattxt';
}
else
{
TxtName.value = '';
TxtName.className = 'flattxt';
}
}
else
{
TxtName.value = 'FirstName';
TxtName.className = 'h_flattxt';
}
Sep 24 '07 #4
singh79
16
Pls I Am Sorry That..

This Code is Not Run ...
Pls Give Me Details How To Run ..

I am Written Same Code sending By U But Not Run ..


Pls Give Me Proper Solution....


Regards
atul
Sep 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by bala | last post: by
4 posts views Thread by Tom | last post: by
4 posts views Thread by Joe Van Meer | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.