Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Focus at Object Level???

Status
Not open for further replies.

Rock6431

Programmer
Mar 23, 2002
56
0
0
US
I was wondering if it is possible to set focus from the object level. I've tried but maybe I'm just calling it wrong. To set the focus on "textbox1" I tried variations of the following (below).

The reason I am attempting this via the object layer is that I need a function that will dynamically redirect my focus via a function call to multiple different items on the page. AND instead of having a crudload of "document.textbox1.focus" IF/Then statements, I figured I would try manuevering thru the object layer on the DOM in one single function call passing the name of the item to focus on as a string to the function.

Any help appreciated.
Rock6431



Dim objElement

strITEM = "textbox1"
Set objElement = document.all(strITEM)
objElement.focus

???
 
What you listed will work. You can also use:
document.all(strItem).focus

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top