Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-10-17
2
Medium Priority
?
236 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Suggested Courses

916 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