Re: Setting focus to a text box on page load
- From: "Eliyahu Goldin" <removemeegoldin@xxxxxxxxxxxxxx>
- Date: Tue, 28 Mar 2006 08:59:28 +0200
Replace
document.forms[0].txtUserName.focus();
with
document.getElementById("txtUserName").focus();
Eliyahu
"William LaMartin" <lamartin@xxxxxxxxxxxxxxx> wrote in message
news:%23H2u99gUGHA.776@xxxxxxxxxxxxxxxxxxxxxxx
All of a sudden code that had been working at my websites to set the focusan
to a particular text box on page load now produces an error.
The code is:
'put the focus on the first text box
Dim strScript As String
strScript = "<script>"
strScript = strScript & "document.forms[0].txtUserName.focus();"
strScript = strScript & "</script>"
Page.RegisterStartupScript("ClientScript", strScript)
And the error produced is: 'document.forms.0.txtUserName' is null or not
object
It is happening in my development computer as well at sites. All I can
figure is that some Windows update changed IIS in some way.
What is the solution?
.
- Follow-Ups:
- Re: Setting focus to a text box on page load
- From: William LaMartin
- Re: Setting focus to a text box on page load
- References:
- Setting focus to a text box on page load
- From: William LaMartin
- Setting focus to a text box on page load
- Prev by Date: Re: How to convert VB.Net code to ASP.Net ?
- Next by Date: Using ItemCreated for a Repeater in VB?
- Previous by thread: Re: Setting focus to a text box on page load
- Next by thread: Re: Setting focus to a text box on page load
- Index(es):