Solved

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

Posted on 2008-10-17
2
230 Views
Last Modified: 2012-06-21
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.

Thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Testing Frame reload</title>
<script type="text/javascript">
// <![CDATA[
function throwtotop() {
        top.location.href=window.frames['main'].src;
}
 
// ]]>
</script>
</head>
 
<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" />
  </FRAMESET>
  <frame frameborder="0" scrolling="no" noresize  marginwidth="7" marginheight="0" src="http://www.yahoo.com" name="session" />
  <NOFRAMES></NOFRAMES>
</FRAMESET>
</html>

Open in new window

0
Comment
Question by:dban00b
2 Comments
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 500 total points
ID: 22747154
"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.
0
 
LVL 1

Author Comment

by:dban00b
ID: 22749282
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
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question