Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Click Event of a Text Box Probs


Message #1 by "Ajay Varghese" <reese@b...> on Mon, 16 Jul 2001 20:37:47 +0530
Hi,

I am trying to achieve the following :

1) Display a Text Box with the default text "Type Here"

2) Clear the Text Box contents when the User Click on the Text box and 

allow him to type.



The code that I am using is pasted below. Could some one tell me why the 

text box doesnt get cleared when I click on it?



Thanks,

Ajay





<HTML>

<HEAD>

 <Script Language=3D"VB" Runat=3D"server">

  Sub onTextClick(sender As Object, e As System.EventArgs)

   txtsearch.Text =3D " "

  End Sub

 </Script>

</HEAD>

<BODY>

<Form id=3D"frmSearch" action=3D"query.aspx" method=3D"post" 

Runat=3D"server">



 <Font face=3D"verdana" size=3D"3" color=3D"Blue">

 Enter the search keywords below :

 </font>

 <BR>



 <ASP:textbox

  id=3D"txtsearch"

  Font_Face=3D"verdana" Font_Size=3D"3"

  Forecolor=3D"gray"

  Value=3D"Type Here"

  ToolTip=3D"Type in your query here"

  size=3D"50" 

  Click=3D"onTextClick"

  Runat=3D"server"/>



</Form>

</BODY>

</HTML>

Message #2 by "Wim Verdeyen" <Wim.Verdeyen@e...> on Mon, 16 Jul 2001 22:01:51 +0200

The textbox webcontrol doesn't has a click event. But you can still do

it with DHTML.



<Script Language=3D"Javascript">

  function onTextClick(){

   frmSearch.txtsearch.value =3D '';

 }

 </Script>





<ASP:textbox

  id=3D"txtsearch"

  Font_Face=3D"verdana" Font_Size=3D"3"

  Forecolor=3D"gray"

  Value=3D"Type Here"

  ToolTip=3D"Type in your query here"

  size=3D"50" 

  onClick=3D"onTextClick"

  Runat=3D"server"/>



Hope this helps



Greetings Wim



-----Original Message-----

From: Ajay Varghese [mailto:reese@b...]

Sent: maandag 16 juli 2001 17:08

To: ASP+

Subject: [aspx] Click Event of a Text Box Probs





Hi,

I am trying to achieve the following :

1) Display a Text Box with the default text "Type Here"

2) Clear the Text Box contents when the User Click on the Text box and

allow him to type.



The code that I am using is pasted below. Could some one tell me why the

text box doesnt get cleared when I click on it?



Thanks,

Ajay






  Return to Index