Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning to home page from frame page.

Status
Not open for further replies.

Lotruth

Programmer
May 2, 2001
133
US
I have a javascript top menu on my home page. I use it to go to a page with frames. When I click the home link to go back from the frames page, it loads the homepage in the top frame as opposed to the whole browser. Thanks for your help.
 

Add this to the body tag of your homepage:

Code:
onload="if (top.location != location) top.location = location;

Hope this helps,
Dan
 

Hmm - but don't forget the closing quote, as I did ;o)

Code:
onload="if (top.location != location) top.location = location;"

Dan
 
Actually no that did not work. Sorry.
 
Here's my frames page maybe it's not correct...

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>


<!-- frames -->
<frameset rows="50%,*">
<frame name="Upper" src="BoardMeetingSelect.cfm" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
<frame name="Lower" src=" marginwidth="10" marginheight="10" scrolling="auto" frameborder="no">
</frameset>
<noframes></noframes>

<BODY>
</BODY>
</HTML>
 

>> Actually no that did not work

What did it do? Did you get any errors? Can you show the code for your homepage, with the addition I gave above?

Dan
 
Are you using JavaScript to open the frameset?

I think if you pass a name to the frameset page you are opening then you can use

onClick="javascript:window.close('NameOfFrameset')"

for the script on your home button

Linq
 
Well sort of. The frame page is opened by clicking a link which is generated by javascript. I dont know if this is a yes or a no. No onclick event is used though. Here ia a short version of the home page...

<html>

<CFINCLUDE template="\menu.cfm">


<head>
<title>Home page</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=1,height=1');");
}
// End -->
</script>
</head>
<body onload="if (top.location != location) top.location = location;">
<center>
<table></table>
</center>

</html>
 
No errors. It just reloaded the home page in the top frame again.
 
Try setting the target of the homebutton link to

parent.top.FRAMENAME (case sensitive)

i.e.
<a href="Blah.html" target="parent.top.FRAMENAME">

you can reference any frame within a frameset using this method and I think it is pretty widely supported.

Linq
 
Whaddayaknow. I searched on the web and found out how to fix this. Billy you were very close. You just have to add this to the head section of the home page and it can never be loaded into a frame. Thanks guys.

<SCRIPT LANGUAGE="JavaScript">
<!--

if (window != top) top.location.href = location.href;

// -->
</SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top