Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
butbut
Joined: Jan 10, 2005
# Posts: 19
|
Posted: 2005-Apr-18 13:38
Hello there...
Can someone tell me how I can create the following effect using javascript on a asp.net textbox:
The textbox say 'type here...' and i want that text cleared when onFocus.
The effect work on a normal html texbox but not on my asp.net textbox.
i'm using the following function that's caled by the onFocus:
(in stead of using the name tag i use getElementById here)
function getEmpty (){
document.form01.getElementById("txt_Search" .value='empty';
}
Thanx in advance
Koen
|
 |
ask_hassan
Joined: Aug 21, 2008
# Posts: 1
|
Posted: 2008-Aug-21 08:28
hi there,
It seems you want the code for the asp.net textbox control to clear the default value.Here is the easiest way.Try this
In aspx.cs,
write this in the page_load
txtUserName.Attributes["value"] = "User Name";
txtPassword.Attributes["value"] = "Password";
txtUserName.Attributes.Add("onFocus", "this.value=''" ;
txtPassword.Attributes.Add("onFocus", "this.value=''" ;
If you face any more trouble with this code.Please let me know.I will clear your doubt.
Regards
-Hassan
|
 |
chyde
Joined: Sep 09, 2008
# Posts: 1
|
Posted: 2008-Sep-10 00:15
Good code, do you know how do you do this in VB? I got an error.
In page load in code behind:
fvOnfocusDelete("tbAcceptDate"
Private Sub fvOnfocusDelete(ByVal fvTbName As String)
Dim tbInitial As TextBox = CType(fvInitial.FindControl(fvTbName), TextBox)
tbInitial.Attributes.Add("onFocus", "this.value =''"
End Sub
Error = Message="Object reference not set to an instance of an object."
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|