Setting focus to a text box on page load
- From: "William LaMartin" <lamartin@xxxxxxxxxxxxxxx>
- Date: Mon, 27 Mar 2006 21:21:39 -0500
All of a sudden code that had been working at my websites to set the focus
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 an
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: Eliyahu Goldin
- Re: Setting focus to a text box on page load
- From: William LaMartin
- Re: Setting focus to a text box on page load
- Prev by Date: Re: Changing page bgcolor from code (repost)
- Next by Date: Re: How to hide some map nodes from menu
- Previous by thread: Re: display empty datetime as blank?
- Next by thread: Re: Setting focus to a text box on page load
- Index(es):