Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text appear when cursor enters 1

Status
Not open for further replies.

boatdrinks

IS-IT--Management
Jun 18, 2004
51
US
if I have an asp.net textbox called textbox2 how do I get the text "DTP" to appear in the textbox when the cursor enters it?
 
One way:

Code:
<input type="text" name="textbox2" onfocus="if (this.value == '') {this.value = "DTP";}" />

*cLFlaVA
----------------------------
"Holy crip he's a crapple!
 

<asp:textbox id="textbox2" runat="server" />

This gives errors when I past the onfucus..... into it
 
Well, I messed up the quotation marks.

Other than that, I'm not very familiar with that form of coding.

For future reference, my code should have been:

Code:
<input type="text" name="textbox2" onfocus="if (this.value == '') {this.value = [red]'[/red]DTP[red]'[/red];}" />

*cLFlaVA
----------------------------
"Holy crip he's a crapple!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top