PDA

View Full Version : Links to open new frames page AND specify frame content


awbrys
12-17-2002, 12:55 PM
Hi!

I have a basic frame-based website that contains links on the left frame, with content on the right. The links on the left change the content on the right.

I wish to create an "entry" page (without frames) that appears prior to this frame-based site (ie, when the site first accessed). However, I want this entry page to have the same links that will firstly open the frame-based site AND then specify which page should be loaded into the frame on the right, depending on which link was clicked on the entry page.

How do I determine which link was clicked on the entry page, and how do I specify (a variable?) in the src of the <frame> tag in the frame on the right?

Just to make it a little more tricky, the links on both the entry page and left-hand frame are created in one Flash movie, and I don't really want to create separate Flash movies for the entry & left-hand frame pages.

Thanks,
Awbrys.

Mr J
12-17-2002, 07:32 PM
One possibility,


Load frameset into new window then load selected page into main frame




<script>
function hmm(page){
Page=page
newwin=window.open("frameset.htm")
setTimeout("newwin.top.main.location=Page",3000}
</script>
<a href="#null" onclick="hmm('page1.htm')">CLICK</a>



Or you could place a script in the page loading into the mainframe
to load the framset itself

Place the following in the frameset page


<SCRIPT LANGUAGE="JavaScript">
<!--
function LoadFrame(){
if (self.location.search){
parent.framename.location = location.search.substring(1,location.search.length);
}
}
onload = LoadFrame
// -->
</SCRIPT>

Where framename is the frame that the page is loaded into

The following is place in the head section of the page you want loaded into its frame.

<SCRIPT LANGUAGE="JavaScript">
<!--
if (self == top){
var url = self.location;
self.location = "frameset.htm?" + url;
}
// -->
</SCRIPT>


And call the page as normal

awbrys
12-18-2002, 10:57 PM
Great - will give the second idea a try. I hadn't thought about doing it that way!

Thanks alot.

awbrys
12-19-2002, 12:10 AM
Works great! Its also good for when a main page is loaded outside the frameset (like when accessed through a search engine). It of course forces the other frame to be loaded beside it.

Thanks again,
Awbrys.