![]() |
|
|
|
#1 |
|
I am already giving focus to my textbox using:
<body onload="document.forms[0].firstName.focus();"> Is there a way to select all the text, if there is any? Thanks, Tom. tshad |
|
|
|
|
#2 |
|
Posts: n/a
|
tshad wrote:
> I am already giving focus to my textbox using: > > <body onload="document.forms[0].firstName.focus();"> > > Is there a way to select all the text, if there is any? Stop wanting that. If a user with a slow connection visits your site, they may start typing in the box before the page has fully loaded; then, when it's done loading, the text they've already typed will be selected. If they don't notice quickly enough, they will keep typing, erasing everything they've already written. Not very fun. |
|
|
|
#3 |
|
Posts: n/a
|
"Leif K-Brooks" <> wrote in message
news:... > tshad wrote: >> I am already giving focus to my textbox using: >> >> <body onload="document.forms[0].firstName.focus();"> >> >> Is there a way to select all the text, if there is any? > > Stop wanting that. If a user with a slow connection visits your site, they > may start typing in the box before the page has fully loaded; then, when > it's done loading, the text they've already typed will be selected. If > they don't notice quickly enough, they will keep typing, erasing > everything they've already written. Not very fun. Good point. Thanks, Tom |
|
|
|
#4 |
|
Posts: n/a
|
On Tue, 18 Jan 2005 15:06:01 -0500, Leif K-Brooks <>
wrote: > tshad wrote: >> I am already giving focus to my textbox using: >> <body onload="document.forms[0].firstName.focus();"> >> Is there a way to select all the text, if there is any? > Stop wanting that. If a user with a slow connection visits your site, > they may start typing in the box before the page has fully loaded; What about doing it later? Like <textbox></textbox><script ...>selectEverythingInTheBoxAbove()</script> or even <textbox onfocus="this.selectAll()"> That said, I must add I don't even know if JS code for selecting the contents exists. It very probably does, I'm just too lazy to check right now. -- Mitja |
|