Results 1 to 2 of 2

Thread: moving item from 1 select to another

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    Unhappy 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

  2. #2
    Fanatic Member pradeepkrao's Avatar
    Join Date
    Sep 2001
    Location
    New Jersey
    Posts
    534

    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
    Learn by others experience as you cannot live long to experience them all.
    www.freewebs.com/pradeepkrao

    LOOK AT MY GAMES AT MY WEB SITE.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width