Web Analytics Made Easy -
StatCounter Creating dynamic listbox items from child window - why does it only work in Netscape? - CodingForum

Announcement

Collapse
No announcement yet.

Creating dynamic listbox items from child window - why does it only work in Netscape?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating dynamic listbox items from child window - why does it only work in Netscape?

    I have a listbox in one window. I'd like to open a 2nd window, have the users select from that window and repopulate the listbox in the parent window.

    I initially did this using frames instead of opening a new window and it worked for Netscape 3,4,6.2 and IE 4,5.5,6.

    Now I removed the frames and simply open a new window. It only works for Netscape (all versions) and doesn't work for any version of IE. I only changed Part 1 and didn't touch Part 2 when I switched from frames to opening a new window. Anyone have any ideas? In IE4, I'm getting a error msg that says "The server threw an exception". It looks like the error is on the new Option line. The deleting of the items in the parent listbox does work on IE, it's the inserting of new items that doesn't seem to work.

    Here's what I do:
    //Part 1
    //************************************************
    // use opener with no frames
    // get the listbox on the parent window
    var e_main_seg = opener.document.emp_form.seg
    //************************************************
    //************************************************
    // use opener with frames
    // var e_main_seg = opener.parent.emp_main.document.emp_form.seg
    //************************************************

    //Part 2
    //delete the items in the listbox of the parent
    e_main_seg.length = 0;

    //now loop thru the items in the current listbox
    //if the item is selected, add it to the parent listbox

    var ctr = 0;
    for(var i=0; i<document.seg_form.seg_count.value; i++)
    {
    if (e.options[i].selected)
    {

    e_main_seg.options[ctr] = new Option(e.options[i].text, e.options[i].value);
    //also tried this syntax but it didn't work
    // e_main_seg.options[ctr] = new Option(e.options[i].text, e.options[i].value,false,false);
    ctr++;
    }
    }

  • #2
    don't cross post, please. it's considered rude.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

    Comment

    Working...
    X