Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now