Solved

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

Posted on 2008-10-17
2
229 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

773 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