Hi Dan,
Does that helps some? If still anything else we can help, please feel free
to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| X-Tomcat-ID: 64558820
| References: <A7************ *************** *******@microso ft.com>
<uY************ **@TK2MSFTNGP15 .phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From:
st*****@online. microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 17 Jan 2006 03:23:10 GMT
| Subject: Re: Textbox that clears on first click
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| Message-ID: <Vc************ **@TK2MSFTNGXA0 2.phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| Lines: 77
| Path: TK2MSFTNGXA02.p hx.gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3713 05
| NNTP-Posting-Host: tomcatimport2.p hx.gbl 10.201.218.182
|
| Hi Dan,
|
| As Eliyahu has mentioned, we can just use some clientside scripts to do
| such work. We can put some initial text in the textbox and then use the
| "onfocus" dhtml event to detect the user's begin inputing , and use
| "onblur" event to detect user's move out ....
| Here are some simple code snippet which simulate such a TextBox:
|
| <HTML>
| <HEAD>
| <title>ClientTe xtBox</title>
| <script language="javas cript">
| function txt_onblur(txt)
| {
| var len = txt.value.lengt h;
|
| if(len <= 0)
| {
| txt.value = "Search.... ";
| }
| }
|
| function txt_onfocus(txt )
| {
| var val = txt.value;
|
| if(val == "Search.... ")
| {
| txt.value = "";
| }
| }
| </script>
| </HEAD>
| <body>
| <form id="Form1" method="post" runat="server">
| <INPUT type="text" id="txtClient" name="txtClient "
| onblur="txt_onb lur(this);" onfocus="txt_on focus(this);"
value="Search.. .."
| />
| <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
| </form>
| </body>
| </HTML>
|
|
| Hope helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure!
www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
| --------------------
| | From: "Eliyahu Goldin" <re************ *@monarchmed.co m>
| | References: <A7************ *************** *******@microso ft.com>
| | Subject: Re: Textbox that clears on first click
| | Date: Mon, 16 Jan 2006 12:38:22 +0200
| | Lines: 29
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| | X-RFC2646: Format=Flowed; Original
| | Message-ID: <uY************ **@TK2MSFTNGP15 .phx.gbl>
| | Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| | NNTP-Posting-Host: 212.143.94.3
| | Path:
|
TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GXA01.phx.gbl!T K2MSFTFEED02.ph x.gbl!tornado.f a
|
stwebnet.it!tis cali!newsfeed1. ip.tiscali.net! border2.nntp.am s.giganews.com! n
|
ntp.giganews.co m!news-out.tin.it!feed er.news.tin.it! 207.46.248.18.M ISMATCH!T
| K2MSFTNGP08.phx .gbl!TK2MSFTNGP 15.phx.gbl
| | Xref: TK2MSFTNGXA02.p hx.gbl
| microsoft.publi c.dotnet.framew ork.aspnet:3710 84
| | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
| |
| | Dan,
| |
| | You need to handle client-site keyboard events in javascript. You will
| have
| | to work out a bit of logic for detecting very first key pressing.
| |
| | Eliyahu
| |
| | "musosdev" <mu*******@comm unity.nospam> wrote in message
| | news:A7******** *************** ***********@mic rosoft.com...
| | > Hi
| | >
| | > I want to have a textbox on my webpage that shows 'Type here' in
gray.
| | > When
| | > you click on the textbox, that text disappears and you can type your
| | > search,
| | > rather than having to select it and press delete.
| | >
| | > Be super-cool if it could also change the textcolor as well.
| | >
| | > Any ideas on how to do this? I dont mind using another control, as
long
| as
| | > its free (its for a charity intranet).
| | >
| | > Cheers
| | >
| | >
| | >
| | > Dan
| |
| |
| |
|
|