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

Calling functions in a different frame - in Netscape

Status
Not open for further replies.

GusBrown

Programmer
Nov 24, 2000
38
GB
Hi all,

I have a frameset and I'd like to call a function in one frame from another frame. The frame I'm in is called "middle", the function I want (setStatus) is in a frame called "lower". This works in IE:

top.lower.setStatus( "text" );

...but not in NN? I can do this:

var myElement = (parent.lower.document).getElementById("messageSpan");
myElement.innerHTML = "text";

...to directly access the same element ("messageSpan") that "setStatus()" does but I'd much rather call the function.

Does anyone know whether it's possible?

Any help much appretiated,

Gus
 
<a href=&quot;javascript:setStatus(\&quot;text\&quot;)&quot; target=lower>
this isn't highly technical but i think it'll work fair enough ;-)
 
Hi iza,

Thanks for the reply, the problem is this: the function setStatus() is actually IN the 'lower' frame and I want to call it from within the 'middle' frame. Any ideas on how to do this in NN?

Gus
 
From the middle frame:

parent.lower.setStatus()

You need to reference the correct object - since you are calling from one frame object - you must 'get out' of it before you can reference any siblings. By using parent, we are meaning the framset page - which has both of these frames as children. ;)
b2 - benbiddington@surf4nix.com
 
Oh - just thought, sometimes Netscape wil only work with arrays - don't know why - you may have to use parent.frames[1] - if above does not work. ;-)
b2 - benbiddington@surf4nix.com
 
gus, i understood and THIS actually calls the function IN the lower window FROM the middle one
(and if ALL your calls from the middle page are to functions in the lower window, you can even set the basetag property to &quot;lower&quot; for the middle page, and you don't need anymore to wonder how to reach the lower window, ALL javascript calls will be redirected to lower)
low tech cross browser solution ... you won't impress any client or teacher with it, but it's robust !
 
<eating humble pie>

Turns out that iza was right! I just kinda looked at the code and thought &quot;no, no, no&quot; but it does indeed work....

Bangers, I still can't get your suggestion to work. That's what I was trying to do initially, maybe it's a problem with NN6.

At least I know how to get around it, I just wish there was a 'nicer' solution.

Thanks guys,

Gus
 
thank you for trying :)) i appreciate :) (most people say &quot;it won't work&quot; without even trying !!)
if it works it's because it's not a nice solution at all ;-) (oh and i remember the property to set is base CODE not base TAG ... well i'm not 100% sure here ...)
now about nn6, it's supposed to work just like ie 4+, but i haven't tested it yet ... did you try to use the same code for nn6 than for ie4+ ?
 
I'm working in IE5.5 and all my javascript ALWAYS works and I just end up spending hours trying to convert it for NN :-(

The solution you gave me does work but I really wanted to call this function from onLoad in the <body> tag of the 'middle' frame. I tried:

parent.frames[2].location = &quot;
and that worked so I thought I'd combine the 2 and try:

parent.frames[2].location = setStatus( &quot;text&quot; );

but it didn't like it much. Ho hum.

Gus
 
This is very similar to an issue that I'm having. I need to access a function via an onClick in a frame that is being called in the frameset. Pretty simple (I hope,) but this is the first time I've done something like this.

How would I go about doing something like this?

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
gus, does parent.frames[2].setStatus(&quot;text&quot;) works ??? can you tell me the error it returns ?

db, please tell us which browser you're targetting ...
 
Iza -

Um... the best I can tell you is that I'm targeting NS. The browser I'm developing for is by Liberate Technologies ( I'm currently developing an application for iTV. So if it works in NS &quot;in theory&quot; it should work for Liberate.

Hope that helps.

- DB

dgtlby@excite.com
Administrator

UBB Developers Network

 
i don't know enough about netscape
either try the 1st solution i gave
or try parent.target_frame_name.function_name
or perform a search in this forum (search tab up there !)
or read the faqs
or wait for gus or bangers to come back here with new idea
or start a new thread ;]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top