...

View Full Version : Executing functions across frames



ashleypower
04-10-2003, 01:45 PM
Is there any way that I can execute a function that is inside a separate frame? What I mean is, can I have a button in the left frame that executes a function in the right frame?

Thanks, any help would really be appreciated.

glenngv
04-10-2003, 01:52 PM
top.frames['NameOfTheRightFrame'].functionInTheRightFrame()

ashleypower
04-10-2003, 02:08 PM
Thanks alot! That does work. Now another question if you please.

I have a left and a right frame. I have a button in the left frame. When I press this button, can I get values from fields in the right frame and place them in fields in the left frame?

See, the way I have it set up now is that there is a test you complete in the left frame, and the values from the questions are passed to the right frame. At the end, I need these values added up, and passed back to the left frame, but I want the right frame hidden.

I have another question. I set the right frame as "hidden" and I get errors. If I set the width of the right frame to "1" the errors disappear. What's wrong?

ashleypower
04-13-2003, 02:23 PM
Anybody? Help would be appreciated.

Roy Sinclair
04-14-2003, 07:22 PM
The answer you got above is pretty much the same as the answer you want now.

top.frames['NameOfTheRightFrame'] give you a reference to any object within the window object for that frame. In the case above you only needed a function which was simple, for other objects you simply add on the rest of what you would use to access the object if it were in the local frame.

top.frames['NameOfTheRightFrame'].forms['nameoftheform'].elements['nameofthefield']

Garadon
04-14-2003, 07:41 PM
u can simply set the frame width to 0 this will in essense hide the frame

glenngv
04-15-2003, 07:53 AM
Originally posted by Roy Sinclair
The answer you got above is pretty much the same as the answer you want now.

top.frames['NameOfTheRightFrame'] give you a reference to any object within the window object for that frame. In the case above you only needed a function which was simple, for other objects you simply add on the rest of what you would use to access the object if it were in the local frame.

top.frames['NameOfTheRightFrame'].forms['nameoftheform'].elements['nameofthefield']

don't forget the document

top.frames['NameOfTheRightFrame'].document.forms['nameoftheform'].elements['nameofthefield']



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum