Results 1 to 6 of 6

Thread: How to pass values to a page with frames?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    How to pass values to a page with frames?

    Can anyone tell me how to pass values to a page with frames.

    From this other window the user would select a value. When they click on the value they want I call a javascript routine that will pass the values to the originating form that is still currently open on another window.

    The code I currently have in the function:

    function sendback() {
    window.opener.frames[1].document.forms[0].txtSupplier.value = document.forms[0].txtSupplier.value
    window.close()
    }

    This code does not seem to work for me though.

    Can anyone please offer some help or suggestions.

    Thanks again.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to pass values to a page with frames?

    //irt.org
    When opening the window using window.open, the new window is a child of the first window, although the first window is not the parent of the new window.

    Make sure the window opening looks something like this:

    Code:
    <SCRIPT LANGUAGE="JavaScript"><!--
    // This creates the popup window.
    function MakeWindow() {
        myWindow=window.open('','windowName','add you list of properties in here');
        myWindow.href = 'apage.html';
        if (!myWindow.opener) myWindow.opener = self;
    }
    //--></SCRIPT>
    Then you can refer to the opener as opener:
    Code:
    alert(opener.location.href);
    So you can simply go

    Code:
    opener.forms[0].txtSupplier.value = 'whatever';

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How to pass values to a page with frames?

    I have no problems passing variables back in javascript, but this time I am passing variables back to a window that contains frames.

    So in the javascript I will have to refer to the frames in one shape or another, but the code that I had posted in the first post is not working for me.

    Do you have suggestions for the frames.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to pass values to a page with frames?

    Did you try what I posted?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How to pass values to a page with frames?

    I did try it, it is what I have been doing for the other windows that open another window and receive a value from that newly opened window.

    The problem is now is that the receiving window has frames. So simply opener.forms does not say which form as now the receiving window has 2 forms on it as well as 2 frames.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: How to pass values to a page with frames?

    I figured it out. In my function to send back the value to the form with frames the javascript had to look like this:

    window.opener.parent.frames[1].document.forms[0].txtField.value = strValue

    The parent had to be there as the webpage that the frames are on is the parent.

Posting Permissions

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



Click Here to Expand Forum to Full Width