troubleshooting Question

Clear textbox text onfocus .net 2.0 web form

Avatar of egdigital
egdigital asked on
JavaScriptASP.NETWeb Applications
7 Comments1 Solution4547 ViewsLast Modified:
I have a couple textboxes that have values initially i.e. 'type text here' and when the user clicks or navigates to the textbox I want the text to disappear.  The textboxes are textboxes and are contained in a masterpage as well as ascx files.  I tried to use this code:

<script type="JavaScript">
    function clearText(boxId)
      txtBox = document.getElementById(boxId);
      txtBox.value = "";

serviceTB.Attributes.Add("onfocus", "clearText(serviceTB);")

But this is not working as I keep getting object expected errors.  Any way to accomplish this in .net 2.0 when using masterpage?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros