Log in

View Full Version : How to select which frames open in a new window



jundo12
05-03-2014, 09:39 AM
i have a html frameset i'm using to act like a place to hold game player choices, primarily because they stick to the player's window statically thru out the game and as a result, act similar to saving player choices to a database. currently, there's a side frame, a footer frame and a main window frame. however, i need to occasionally break out of the footer frame, while retaining the already selected data in the side frame. how do you break out of 1 frame in your frameset without losing the stickiness in the other frames?

or even better is there a way to modify the size of the frames between page clicks? for example


<frameset cols="12%,*" frameborder="0" border="0" framespacing="0" >
<frame name="menu" src=".html" marginheight="0" marginwidth="0" scrolling="no" >
<frame name="content" src=".html" marginheight="0" marginwidth="0" scrolling="no" >


</frameset>

upon click, changed to


<frameset cols="22%,*" frameborder="0" border="0" framespacing="0" >
<frame name="menu" src=".html" marginheight="0" marginwidth="0" scrolling="no" >
<frame name="content" src=".html" marginheight="0" marginwidth="0" scrolling="no" >


</frameset>

without effecting the stickiness of the data in the frames?

jscheuer1
05-03-2014, 01:23 PM
See:

http://www.dynamicdrive.com/dynamicindex8/collapsemain.htm

jundo12
05-03-2014, 01:46 PM
thanks. :D so a link click on another page that uses that script, can resize (not close) a targeted frame on the page that's being linked, when you click the link?

jscheuer1
05-03-2014, 04:08 PM
The link can change the size (to 0 if desired) of a frame in the parent (frameset page). If you also want that link to do other things at the same time, it can, ex:


<a href="some.htm" onclick="parent.resizeFrame('*,0'); return true;">Some page</a>

Of course you can also use it in the 'normal' way as shown on the demo page.

jundo12
05-08-2014, 09:20 PM
it works great except it didn't want to work in google chrome. when clicked, nothing happened. so i got a new bit of javascript to add to it, that tells it to open in the named frame window. here's the whole thing


<a href="mypage.html" onclick="parent.resizeFrame('*,2');

parent.content.location='mypage.html'">

it also doesn't work in google chrome but it does work in ff and ie. anyway to resolve that?

jscheuer1
05-09-2014, 01:10 AM
Google Chrome sometimes has issues with frames unless the pages are all live. Have you tried it live, or are you still just experimenting locally?

jundo12
05-09-2014, 04:24 AM
oh, i didn't think to try that. you are right! yep it works live. thanks :D