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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab key question

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
When the user presses the tab key the onblur event is fired for the field that has focus (window.event.srcElement represents this field). In the OnBlur event how can I tell which field is about to receive focus? That is, in the OnBlur event I need to know which field I'm coming from (srcElement) and which field I'm going to.
 
Not positive, but I believe that each item in the tab list should have a .TabOrder property or something similar. In that case, you should be able to easily find the .TabOrder of the object firing the OnBlur. Then add one and find the onject with that Tab Order +1.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I explained my problem incorrectly. Actually, it is not just limited to the tab key. The user could click on another field (rather than tabbing). So on the OnBlur event how can I determine which control is about to receive focus?

Basically, I have a Div tag that contains several controls. I need to know if the field that is about to receive focus is within the Div tag or not. (Be nice if there was OnBlur event for Div tags)
 
I'll be happy to find out that I'm wrong, but I just don't think it is possible for OnBlur to know where the focus is going. You can fire OnBlur by simply clicking the page's background and not hitting another element at all. YOu can see the mouse X,Y coords in the OnBlur event, but that seems like a painful path that I would not want to go down.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top