K
Kevin Quigley
Hi,
I have an application that allows users to select items from one listbox
and in doing so the item is removed from the original list and displayed
in the other.
I had this working in the code behind page but each selection resulted
in a postback. I have now tried to implement this using javascipt and
the transferring of items works fine, but when I try access the items
that the user has selected (in the onClick event of a button) they are
not available. Does anyone know how I can solve this?
Here is the javascript I use to transfer items between listboxes.
function transferOption()
{
var object = document.Form1;
var index = object.ListBox1.selectedIndex;
if (index > -1)
{
var newoption = new Option(object.ListBox1.options[index].text,
object.ListBox1.options[index].value, true, true);
object.ListBox2.options[object.ListBox2.length] = newoption;
if (!document.getElementById) history.go(0);
object.ListBox1.options[index] = null;
object.ListBox1.selectedIndex = 0;
}
}
Any help on this would be gratefully appreciated.
Thanks,
Kevin
I have an application that allows users to select items from one listbox
and in doing so the item is removed from the original list and displayed
in the other.
I had this working in the code behind page but each selection resulted
in a postback. I have now tried to implement this using javascipt and
the transferring of items works fine, but when I try access the items
that the user has selected (in the onClick event of a button) they are
not available. Does anyone know how I can solve this?
Here is the javascript I use to transfer items between listboxes.
function transferOption()
{
var object = document.Form1;
var index = object.ListBox1.selectedIndex;
if (index > -1)
{
var newoption = new Option(object.ListBox1.options[index].text,
object.ListBox1.options[index].value, true, true);
object.ListBox2.options[object.ListBox2.length] = newoption;
if (!document.getElementById) history.go(0);
object.ListBox1.options[index] = null;
object.ListBox1.selectedIndex = 0;
}
}
Any help on this would be gratefully appreciated.
Thanks,
Kevin