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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From frameset to frameset? 1

Status
Not open for further replies.

oldnewbie

Technical User
Dec 6, 2000
9,142
CA
Hi all,

First frameset...
| top |
| content |
| bottom |

Second frameset...
| left | right |

Second frameset is loaded in the "content" frame of the first frameset from the top frame. How can I target a function in the top frame from the right frame?

If I use parent or top, I can target a function in content, but haven't succeeded in targeting a function in top?

 
Rename your framename that you are currently calling "top". This is a reserved word and likely this is the cause of your problem. That is why I tend to append the string "Frame" to the end of all my frame names.

Hope that solves your problem!

Jeff
 
following BabyJeffy's advice, you should then be able to use something like so from the right:

parent.parent.topFrame.function();



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Thanks, but "top" was just a named used here, I do know it's a reserved word.
As for parent.parent... Think I tried that (will again!) but it didn't work.

Remember that the second frameset is loaded with a link from the top frame. There is in fact another frameset loaded up in the content frame before this new left-right frameset is loaded up through the link in the top frame. This isn't defined as a frameset within a frameset... It's like, as I see it, if it was 2 different windows so to speak.

Any other thoughts?
 
if your frames are set up like so, this works for me:

[main frameset]
<frameset rows=&quot;30%,*&quot;>
<frame src=&quot;topFrame.html&quot; name=&quot;topFrame&quot;/>
<frameset rows=&quot;30%,*&quot;>
<frame src=&quot;contentFrame.html&quot; name=&quot;contentFrame&quot;/>
<frame src=&quot;bottomFrame.html&quot; name=&quot;bottomFrame&quot;/>
</frameset>
</frameset>

[content frame]
<frameset cols=&quot;50%,*&quot;>
<frame src=&quot;leftFrame.html&quot; name=&quot;leftFrame&quot;/>
<frame src=&quot;rightFrame.html&quot; name=&quot;rightFrame&quot;/>
</frameset>

[right frame]
<input type=&quot;button&quot; value=&quot;topFrame.foo();&quot;
onclick=&quot;parent.parent.topFrame.foo();&quot; />

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Thanks Jemminger... I really want to get to the bottom of this, so if you're still around today, please continue to help me out if you can...

I'll experiment your proposal, but let me just say this for the moment...

My original main frameset would differ from your's, in the fact that it's not a frameset within a frameset, but only one with 3 rows, topFrame, maincontentFrame, bottomFrame.
The maincontentFrame frameset originally holds another frameset with 2 cols, leftcontentFrame and rightcontentFrame.

But when this is running, a link in the topFrame loads up a new frameset in the maincontentFrame, let's call it newleftFrame and newrightFrame. It's in that situation, from the newrightFrame, that a call to a function in topFrame (with parent.parent.topFrame.foo()) doesn't seem to work.

You seam to be saying that such a call from the original rightcontenFrame would work (I still have to check that out), but it doesn't seem to work when the original maincontentFrame is changed, especially from a link in the topFrame?

Am I making sense?
 
well, i changed the main frameset to

<frameset rows=&quot;30%,30%,*&quot;>
<frame src=&quot;topFrame.html&quot; name=&quot;topFrame&quot;/>
<frame src=&quot;contentFrame.html&quot; name=&quot;contentFrame&quot;/>
<frame src=&quot;bottomFrame.html&quot; name=&quot;bottomFrame&quot;/>
</frameset>

and i have a link in topFrame that loads contentFrame2 containing leftFrame2.html and rightFrame2.html

the same call from rightFrame2.html still works
parent.parent.topFrame.foo();

can you provide a link to your page or post them all here?


=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Checking it out at the moment... Will be back shortly, if I can't get it going!

Thanks again!
 
Yep! It seems to be working fine, in my mockup!
Probably got something wrong in the real thing - I'm actually trying to help someone else controlled a Flash sound player in his topFrame -, will have a second try at the real thing...

Thanks again, for now!
 
One last question, please...

Is it possible to have 2 calls in the same &quot;a href&quot;?

In other words, if I have...
Code:
Grammy.com - <a href=&quot;[URL unfurl="true"]http://www.grammy.com&quot;[/URL] target=&quot;_blank&quot;>www.grammy.com</a>

How can I add javascript:parent.parent.topFrame.my_alert(); to the same a href above?

I know the following works, adding the window.open(url) to my my_alert() function, but I would prefer that the opening of the window not be included in the my_alert() function.
Code:
<a href=&quot;javascript:parent.parent.topFrame.my_alert('[URL unfurl="true"]http://www.grammy.com');&quot;>CLICK[/URL] HERE TO STOP PLAYER AND OPEN LINK</a>

If possible what would the correct syntax be?
 
like so?
Code:
<a href=&quot;[URL unfurl="true"]http://www.grammy.com&quot;[/URL] target=&quot;_blank&quot; onclick=&quot;parent.parent.topFrame.my_alert();&quot;>www.grammy.com</a>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Sorry, no go on that! Link is open but the function not called?
 
works for me in IE and Moz

are you calling this from the same frame (right)?

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Yep! Same frame, and as I say link is opened but the onclick doens't seem to work.
In fact if I try any syntax variant of the following, with the onclick alone...

<a href=onclick=&quot;parent.parent.topFrame.my_alert();&quot;>
Only an attempt to open a page in the right frame occurs.
 
well, this is invalid syntax:
<a href=onclick=&quot;parent.parent.topFrame.my_alert();&quot;>

another way would be to have your function perform both the navigation and other duty:

function my_alert(url) {
window.open(url);
//...do the other stuff
}

<a href=&quot;#&quot; onclick=&quot;parent.parent.topFrame.my_alert(' return false;&quot;></a>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
If you refer to my above posts, I did manage that earlier in the process. It works fine if the opening of the link is included (as you just suggested) in the called function. I was just wondering, if it was possible to have 2 calls within one &quot;a href&quot; tag. Apparently not or at least not if the second call is an onclick event.
Why is it so, since I believe you could have two different calls on an html button, but can't have it on a &quot;a href&quot; tag?

Once again thanks for your continuous support on this.
 
>> Apparently not or at least not if the second call is an onclick event.
works fine for me ;-)


you could also try

<a href=&quot;#&quot; onclick=&quot;parent.parent.topFrame.my_alert(); window.open(' return false;&quot;></a>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Nope! With this last bit, nothing shows up on the page!

Could any of this be happening because I'm still on IE5.5?
 
>> &quot;Could any of this be happening because I'm still on IE5.5?&quot;
maybe...i only have IE6 to test. perhaps try on some other machine with 5.5 or 6

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Dumb me![BIGCHEEKS]

Your...
Code:
<a href=&quot;[URL unfurl="true"]http://www.grammy.com&quot;[/URL] target=&quot;_blank&quot; onclick=&quot;parent.parent.topFrame.my_alert();&quot;>www.grammy.com</a>

...Did work!

I had textually copied your code, but had changed my function to my_alert1(), so that's why it didn't work!

Thanks again for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top