Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

BBS: Re: Who has the focus? - June 10, 1998 at 03:35:44

You are here: irt.org | BBS | Re: Who has the focus? [This BBS is closed]

Posted by Martin Webb on June 10, 1998 at 03:35:44:

In Reply to: Who has the focus? posted by Rachel on June 09, 1998 at 15:23:53:

: Folks, how can I find out which frame of my page has the focus
: if there is no way I know how many frames I have on that page?

Frames/Windows do not have a focus property that you can interrogate to find out whether the frame/window has focus.

You can trap, using JavaScript, when a frame/window, gains of loses focus using the onFocus and onBlur event handlers:

<BODY onFocus="parent.focus='xyz'" onBlur="parent.focus=''">

The above code will set a variable called focus in the parent frame to 'xyz' when the frame gains the focus, and resets it to blank when it loses focus. You could then interrogate the value of this variable.

To find out how many frames are in the current document:

alert (frames.length);

Follow-ups:

You are here: irt.org | BBS | Re: Who has the focus? [This BBS is closed]

©2018 Martin Webb