Dragons_Bane
05-18-2003, 12:40 PM
Hey all. I want to take Options from one listbox and put them in another one when someone clicks the "Add" button and I'm getting a strange error when doing this.
Here's my code
function btnAdd_onclick()
{
var flist = document.forms("Form1").List1;
var olist = document.forms("Form1").List2;
var item = new Option;
item = flist.options(flist.selectedIndex);
olist.options.add(item);
return 0;
}
And from what I found on another site ths should work but I'm getting an 'Object Expected' Error on line 10 (the '{' that starts the function) I think the rest will work but I don't know what's going on.
Additional Info... List1 Has <OPTIONS> in it, but List2 doesn't, would that make a difference (I don't think it would)
HELP!!! this is frustrating when I can't find the error.
And Thanks in advance.
Shawn
Here's my code
function btnAdd_onclick()
{
var flist = document.forms("Form1").List1;
var olist = document.forms("Form1").List2;
var item = new Option;
item = flist.options(flist.selectedIndex);
olist.options.add(item);
return 0;
}
And from what I found on another site ths should work but I'm getting an 'Object Expected' Error on line 10 (the '{' that starts the function) I think the rest will work but I don't know what's going on.
Additional Info... List1 Has <OPTIONS> in it, but List2 doesn't, would that make a difference (I don't think it would)
HELP!!! this is frustrating when I can't find the error.
And Thanks in advance.
Shawn