470,643 Members | 1,377 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,643 developers. It's quick & easy.

frames issue

I'm sure this question has been asked many times, but I cannot find an
answer that will help me do what I need to do.

I have a site with 2 frames -- 'top' and 'main'. 'top' is a navigation
/ menu bar and 'main' is the content (parent).I'm looking for some
clientside code that will change the URL of the 'top' frame when a
specific URL is loaded into the 'main' frame.

For instance when "stuff.htm" is displayed in 'main', I want
"stuffnav.htm" to be displayed in 'top'. When "otherstuff.htm" is
displayed in 'main', I'd like "otherstuffnav.htm' to be displayed in
'top'

Make sense? If anyone has some code samples to share or ideas, I'd
appreciate it.

TIA for all your help.

-- Kyle
Jul 23 '05 #1
2 1112
In article <8a**************************@posting.google.com >, kbweb02
@yahoo.com enlightened us with...

I have a site with 2 frames -- 'top' and 'main'. 'top' is a navigation
/ menu bar and 'main' is the content (parent).I'm looking for some
clientside code that will change the URL of the 'top' frame when a
specific URL is loaded into the 'main' frame.

I assume the frameset names the frames "top" and "main".
Also, the content (main) is not a parent.
For instance when "stuff.htm" is displayed in 'main', I want
"stuffnav.htm" to be displayed in 'top'. When "otherstuff.htm" is
displayed in 'main', I'd like "otherstuffnav.htm' to be displayed in
'top'


Note: the following will not function at all if people don't have script
enabled. This is a Bad Thing for internet sites.

Anyway, you asked...

In the onload of stuff.htm

<body onLoad="top.frames['top'].location='stuffnav.htm'">
--
--
~kaeli~
Why do they sterilize the needles for lethal injections?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
kaeli wrote:
In article <8a**************************@posting.google.com >, kbweb02
@yahoo.com enlightened us with...
Please do not write attribution novels:
<http://netmeister.org/news/learn2quote1.html>
For instance when "stuff.htm" is displayed in 'main', I want
"stuffnav.htm" to be displayed in 'top'. When "otherstuff.htm" is
displayed in 'main', I'd like "otherstuffnav.htm' to be displayed in
'top'


Note: the following will not function at all if people don't have script
enabled. [...]


More, it will not work if the document is not displayed within a frameset.
[...]
In the onload of stuff.htm

<body onLoad="top.frames['top'].location='stuffnav.htm'">


Since it is possible that the document is not displayed within a frameset,
and "top" and related properties are proprietary, the following is better:

function loadFrame(sName, sURI)
{
var f = null;
if (typeof top != "undefined"
&& typeof top.frames != "undefined"
&& typeof top.frames[sName] != "undefined")
&& (f = top.frames[sName])
&& typeof f.location != "undefined")
{
f.location = sURI;
}
}

<body onload="loadFrame('top', 'stuffnav.htm')">

This will of course not work without client-side script support either.
PointedEars
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Richard | last post: by
40 posts views Thread by JohnnyCJohnny | last post: by
34 posts views Thread by s c o t t | last post: by
95 posts views Thread by Neal | last post: by
2 posts views Thread by K.C. Brown | last post: by
7 posts views Thread by Melinda | last post: by
4 posts views Thread by matthias s. | last post: by
56 posts views Thread by Deepan HTML | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.