works on Mozilla doesn't work on IE window.opener.document

Discussion in 'Javascript' started by Peter, Jun 13, 2006.

  1. Peter

    Peter Guest

    Hello all, i'm very new at javascript and I was hoping somebody could
    help me out.

    I have the following javascript code inside a php form:

    foreach ($cm_phase_val['PHASES'] as $key => $ph){
    echo <<<EOM

    <script>
    var defaultSelected = false;
    var selected = false;
    var optionName = new Option('$ph', '$ph', defaultSelected, selected)
    var length = window.opener.document.$form_name.$field_name.length;
    window.opener.document.$form_name.$field_name.options[$key]= optionName;
    </script>

    EOM;

    }

    basically it takes a values from column in a table and displays it on
    the parent window drop down.

    For some reason it only works on Mozilla. doesn't work on IE and don't
    know how to debug it on IE. It doesn't have a javascript console debugger.

    Can somebody give me some tips.

    Thanks
    Peter
    Peter, Jun 13, 2006
    #1
    1. Advertising

  2. Peter wrote:

    > var optionName = new Option('$ph', '$ph', defaultSelected, selected)


    Try
    var optionName = new window.opener.Option('$ph', '$ph',
    defaultSelected, selected)
    instead.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jun 13, 2006
    #2
    1. Advertising

  3. Peter

    Peter Guest

    Martin Honnen wrote:
    >
    >
    > Peter wrote:
    >
    >> var optionName = new Option('$ph', '$ph', defaultSelected, selected)

    >
    > Try
    > var optionName = new window.opener.Option('$ph', '$ph',
    > defaultSelected, selected)
    > instead.
    >
    >
    >

    yes

    thank you. it works

    Peter
    Peter, Jun 13, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leon
    Replies:
    1
    Views:
    10,172
    Boban Dragojlovic
    Jun 24, 2003
  2. Andrew Bewley via DotNetMonster.com

    window to window communication (window.opener)

    Andrew Bewley via DotNetMonster.com, Feb 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,025
    Andrew Bewley via DotNetMonster.com
    Feb 3, 2005
  3. Urs Gubler
    Replies:
    0
    Views:
    140
    Urs Gubler
    Jul 2, 2003
  4. Giakko
    Replies:
    9
    Views:
    358
    Randy Webb
    Apr 14, 2006
  5. window.opener, form.opener?

    , Jul 14, 2006, in forum: Javascript
    Replies:
    5
    Views:
    272
Loading...

Share This Page