Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Enlarge Frame

I have a page with three frames, a title page (top), a link page (left), and a chapter page(right). The Frameset page contains a book (the links open the various chapters), and I would like to place a button on the link page that enlarges the right frame to take up the whole broswer. (This way the reader who has a small screen doesn't have to scroll as much.)

I messed around a little using the window.frame property, but I couldn't get it to work.

  • 2
1 Solution
First of all do not NAME frame in your frameset "top"! This is reserved word :)

You can reopen content frame in the main window. (throwing out frameset)
<a href="javascript:void(0)" onClick="top.window.location.href=top.frames['right'].location.href; return false;">
Above suppose that you have frame named "right" in your frameset.

assuming you have this frameset:

<frameset cols=30%,*>
  <frame name=left src=left.htm>
  <frameset name=fset rows=20%,*>
    <frame name=top src=top.htm>
    <frame name=right src=right.htm>

on your left.htm include an onclick event like this on your links:

WillPAuthor Commented:
I wanted a button, so here's my final code.

  <p><input type="Button" onClick="top.window.location.href=top.frames['right'].location.href; return false;"value="Full Page" name="Bt1"></p>

The naming of the top frame "top" doesn't seem to matter in this case, though I'll probaby change it anyway.


In this particular case in context of righ frame "top" as frame name isn't in scope, so it works, but in case you
want  to do something like parent.top.location="bla.html"

parent.top may refer as top window of the parent window (reserved word)
as well as 'top' frame of parent window (frame by name)
This migh result in unexpected sideeffects....


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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