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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Round Rock, Texas
    Posts
    443
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to Insert values from parent page?

    I have a bit of a "chicken or the egg" dilema I think...

    I open a new window and I want a <SELECT> object (named "newList") to be populated with values from a like <SELECT> object in the parent page.

    <body onload="initialize(this.form)">; (in the newly created window) doesn't work. I get a message that "newList is null or is not an object."

    I think that at the point the initialize(this.form) function is triggered, the form containing the <SELECT> object hasn't been loaded / built yet - or at least the <SELECT> object itself does not yet exist.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Iran
    Posts
    695
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, first of all, if the new pop up window that you're making is just for showing the items of that <Select> tag, then it's better that you do the following:

    1- Open your new window in the parent window by typing
    something like : newWin = window.open("Z.html","");
    2- Then write :
    newWin.document.write("<body onload=initialize(" +
    this.form + ")>")

    But if they're some other things already written in your new page, and you don't want to destroy them by using document.write in the parent page, use "window.opener" in the new window:

    <body onload=initialize(window.opener.this.form)>

    it should work!

    You can also use frames! it's really easier, u define everything that you'll need later to be used in child frames in the main page, then you can easily refer to all of them by top.NameOfYourElement. You won't have the chicken or the egg problem any more!

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Round Rock, Texas
    Posts
    443
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The mystery is solv'ed. The answer is on this thread:
    http://www.codingforums.com/showthre...&threadid=1856


  •  

    Posting Permissions

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