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.
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++;
}
}
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.
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++;
}
}
Comment