• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Catch a frame's onfocus to move that frame to _top

I have an html frameset and I would like to catch when a user clicks into a particular frame to move that frame to the top (ie: bust out of the frame if you click in the frame)  The frame is not mine so I can't change anything within the frame's source code.

How can I, from the frameset page, bust out another frame to the _top if the user clicks in it?

I've attached my latest attempt's code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Testing Frame reload</title>
<script type="text/javascript">
// <![CDATA[
function throwtotop() {
// ]]>
<FRAMESET cols="*, 165">
  <FRAMESET rows="120, *">
      <FRAME frameborder="0" marginwidth="5" marginheight="5" border="0" src="http://www.google.com" name="main" onfocus="throwtotop();return false;" />
      <FRAME frameborder="0" marginwidth="5" marginheight="5" border="0" src="http://www.experts-exchange.com/" name="forum" />
  <frame frameborder="0" scrolling="no" noresize  marginwidth="7" marginheight="0" src="http://www.yahoo.com" name="session" />

Open in new window

1 Solution
"How can I, from the frameset page, bust out another frame to the _top if the user clicks in it?"

You cannot.  The onClick() event will be acting on the framed page, there will be no onclick() event on the frameset page, so it cannot detect when the frame is clicked on, only the framed page can, and if this code is out of bounds, then you cannot do it as you want.

The best you can do is set a series of links in the MAIN frame, so that you can move any frame to the top of the list based on a click in that main frame.
dban00bAuthor Commented:
I solved it by having the page in the 'forum' having an onblur event that changed the fame sizes.  Not quite the _top i wanted, but it works

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now