I suspect you're not putting that code in the right place. You should put
that code just before the </form> tag to run when the page loads, or call
the function from the body onload event.
If the error you're getting is accurate it sounds like your control is
actually not visible in which case you can't set focus. Otherwise that
should work - I use the same approach, although I've built it into my custom
Page class.
Select is IE specific I think... but since you're using VBScript I guess
you're targeting IE anyway.
+++ Rick ---

Signature
Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog
> How do I highlight text in my first (tabindex = 1) asp control (eg:
> textbox) on the webform on page load. If I try to set focus using
[quoted text clipped - 21 lines]
> MyPage.Controls.Add(ctrLiteralControl)
> End Sub
parm - 28 Oct 2005 22:42 GMT
Hi Rick,
My javascript to set focus is within a vb.net function called
SetFocus(). I am calling this function from vb.net page load event.
Because the page is not loaded when the SetFocus() function is called
therefore I am getting the above error message. I also call the same
SetFoucs() function from other places in my code and it works fine. I
just cannot get it to work on page load. I am calling some other
function on body onload event + my javascript is embeded in vb.net
function.