PDA

View Full Version : opening frameset page with correct page loaded


marilynn.fowler
08-15-2002, 06:15 PM
I have a <body> page with a number of buttons. I have another <frameset> page with two frames: the top frame (named "mymenu") contains the menu and the bottom frame (named "kinetic") has the content. I would like to be able to click a button on the <body> page and have it open the <frameset> page with the appropriate page in the bottom frame. I do not want to launch a new window. How is this done?

Also, how do I do a "force frames" with the appropriate page in the bottom frame?

Any guidance will be greatly appreciated.

requestcode
08-15-2002, 06:42 PM
Some one in this forum gave me this To force a page into a frame. The first part you would place in the head section of the page you want to force into a framed page:

<html>
<head>
<title>Force Frames Test</title>
<SCRIPT LANGUAGE="JavaScript">
if (self == top)
{
var url = self.location;
self.location = "http://www.requestcode.com/frset.html?" + url;
}
</SCRIPT>
</head>
<body>
Some text
</body>
</html>


The above code checks to see if the page is the top most and if it is it grabs the location attaches it to the url and redirects to your famed page. Here is the code that you would use in your frameset page:

<html>
<head>
<title>Frame Print Demo</title>
<SCRIPT LANGUAGE="JavaScript">
function frame_saver()
{
if (self.location.search)
{
parent.frameb.location = location.search.substring(1,location.search.length);
}
}
window.onload = frame_saver;
</SCRIPT>
</head>
<frameset rows="25%,*" border="1">
<frame src="looka.html" name="framea">
<frame src="lookb.html" name="frameb">
</frameset>


The above code checks to see if there is a value after the question mark (?) in the url and if there is will load the page into frameb. Frameb is set up with a default page so that if the framed page is gone to directly there will be something there. You could probably use this same concept for your first question.

marilynn.fowler
08-15-2002, 07:51 PM
You my just be my new hero!

So, for the <body> page with the button, is the following code correct?

<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function Gimme(url){
self.location="http://www.whatever.com/framepage.html?"+url
}
//-->
</SCRIPT>
</HEAD>

<BODY>
<A HREF="javascript:Gimme('blah.html');"><IMG SRC="whatever.gif"></A>
</BODY>

Mr J
08-17-2002, 07:10 PM
If the above doesn't work then try the following link.

www.huntingground.freeserve.co.uk/webplus/frames/loader2.htm


This is the address to a specific page on my site which will load into your browser.

BUT.....

This page belongs to a three frame frameset and should be loaded into the main frame so.........

The script realises it is not in the main frame and loads the parent frameset, the correct section header, and the page into the main frame.

Go see.

If you need any further help you can contact me through my site.


:thumbsup:

GurusGuru
08-19-2002, 01:13 PM
The script mentioned by "requestcode" works fine. Can it be further modified so that:

1. The main page loads first them the requested page. Eg. The index page has 1 frame with main.html as default page in it. Now if one wants to open xyz.html in the index page frame set then main.html loads first and then xyz.html. Is it possible to directly load xyz.html in the correct frame instead of main.html getting loaded first.

2. The address bar shows http://www.abcd.com/index.html?http://www.abcd.com/xyz.html. Is it possible to just show only http://www.abcd.com