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

Passing text to a function in another frame @ onLoad...

Status
Not open for further replies.

ChrisMacPherson

Programmer
Jul 3, 2000
157
GB
hi all,
I want to pass some text from one document to a function which is defined in a second document( both in a frameset, and loaded at the same time). I want this to happen when the first document loads, so I'll be using the onLoad( ). The document that is receiving the text is always loaded before the second one.

Does i actually matter which frame the receiving function is in ? Is the javascript function still attached to the document that it loaded from or can any other documents use it ?

Can anyone help with this? I hope I have explained this enough, if not I'll try again.
Chris MacPherson
thedamager@hotmail.com
Bring on the new Browza's!!

Learn/t/ing D\HTML, Javascript, Java, VB5-6, COBOL, Pascal
 
I have managed to get round this problem by loading the same .js file from each document.

Can anyone provide me with some information on how the browser/s store javascript functions or, what I'm trying to get at is, what relationships do loaded scripts have with the various documents that are loaded. Which documents can use the loaded scripts?

If you can make any sense of that, and help, then you can clearly see that I am confused!! Thanks.
Chris MacPherson
thedamager@hotmail.com
Bring on the new Browza's!!

Learn/t/ing D\HTML, Javascript, Java, VB5-6, COBOL, Pascal
 
one file actually "knows" the js code that is in itself and that's all
so :
- if you define a function in a file, then that file knows the function;
- if you embed a js file in another file, both knows the functions defined IN THE EMBEDDED file;
- and about the frameset : if the function is defined in the frameset file then it is known only by the framset file (not by the frames !!) - if you define the function in one of the frames, it is not known by the other frames nor by the frameset file ...
 
you can access a function (someFunc()) defined in, lets say, contentframe (named in your frameset) by using:

parent.contentframe.someFunc()

and functions etc stored in the frameset can be accessed as follows:

parent.someFunc() jared@aauser.com
 
oh yes, sorry !! good that you are here, jaredn !!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top