|
-
Aug 29th, 2001, 05:01 AM
#1
Thread Starter
Hyperactive Member
moving item from 1 select to another
Hello,
How can I move an item from one select box to another when the user clicks a
button, using ASP/VBScript.
IE.
I have a select called "names" and a select called "friends". The "names" select is
filled with 50 different options or names. The "friends" select is empty.
I now have a button called "ADD", which when clicked on, must copy the selected option in the
"names" select to the "friends" select!! So, when the user is finished he will have a list
of names in the "friends" select box which he chose from the "names" select box.
Corny example, I know, but it will do just what I'm looking for!! - Any takers??
Thanks,
T
-
Sep 3rd, 2002, 06:19 AM
#2
Fanatic Member
Hi
JavaScript:
var x = document.Form1.Select1
var y = document.Form1.Select2
var opt = new Option
opt.text = x.options[x.selectedIndex].text
opt.value = x.options[x.selectedIndex].value
y.add(opt,1)
x.remove(x.selectedIndex)
Regards,
Pradeep
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|