TheBestOfMe
Programmer
I open a pop-up window and I take a <select multiple> values and move them to another <select multiple> but the window that called my pop-up.
the code works well under Netscape, but freeze my Explorer6.
I use the same code as if I was moving my values between two <select> in the same window, but the TO is a reference to the <select> in the opener window.
Here's the code
function SendValue()
{
var to = window.opener.document.form.list;
var from = document.form.list;
selectAllOptions(from);
moveSelectedOptions(from,to);
}
function moveSelectedOptions(from,to)
{
// Move them over
for (var i=0; i<from.options.length; i++)
{
var o = from.options;
if (o.selected)
{
to.options[to.options.length] = new Option( o.text, o.value, false, false);
}
}
// Delete them from original
for (var i=(from.options.length-1); i>=0; i--)
{
var o = from.options;
if (o.selected)
{
from.options = null;
}
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
function moveAllOptions(from,to)
{
selectAllOptions(from);
moveSelectedOptions(from,to);
}
function selectAllOptions(obj)
{
for (var i=0; i<obj.options.length; i++)
{
obj.options.selected = true;
}
}
The code to move <select> values works well under IE and Netscape if the two <select> are in the same window.
This is the last compatibility problem living in my site and I want to kill it.
Thanks
the code works well under Netscape, but freeze my Explorer6.
I use the same code as if I was moving my values between two <select> in the same window, but the TO is a reference to the <select> in the opener window.
Here's the code
function SendValue()
{
var to = window.opener.document.form.list;
var from = document.form.list;
selectAllOptions(from);
moveSelectedOptions(from,to);
}
function moveSelectedOptions(from,to)
{
// Move them over
for (var i=0; i<from.options.length; i++)
{
var o = from.options;
if (o.selected)
{
to.options[to.options.length] = new Option( o.text, o.value, false, false);
}
}
// Delete them from original
for (var i=(from.options.length-1); i>=0; i--)
{
var o = from.options;
if (o.selected)
{
from.options = null;
}
}
from.selectedIndex = -1;
to.selectedIndex = -1;
}
function moveAllOptions(from,to)
{
selectAllOptions(from);
moveSelectedOptions(from,to);
}
function selectAllOptions(obj)
{
for (var i=0; i<obj.options.length; i++)
{
obj.options.selected = true;
}
}
The code to move <select> values works well under IE and Netscape if the two <select> are in the same window.
This is the last compatibility problem living in my site and I want to kill it.
Thanks