Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Mar 2003
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Executing functions across frames

    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.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    top.frames['NameOfTheRightFrame'].functionInTheRightFrame()
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2003
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    New Coder
    Join Date
    Mar 2003
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Anybody? Help would be appreciated.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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']

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    u can simply set the frame width to 0 this will in essense hide the frame

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    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']
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •