#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Moving Between ListBoxes


    I am wanting to move zipcodes between two listboxes. I have one listbox(Office Zips) that has all of the database zip codes pulled from the server and another listbox (User Zips) that holds the zip codes for that particular user. I want to be able to add zipcodes that are selected from Office Zips listbox into User Zips listbox at the top of the list.

    Here is the code that I have so far:

    Code:
         function Move(OfficeBox,ZipsBox) {
    
                var olist = document.getElementById('<%= OfficeBox.ClientID %>');  
                var zlist = document.getElementById('<%= ZipsBox.ClientID %>'); 
    
                for (var i = 0; i < zlist.options.length; ++i) {
    
                    if (olist.options[i].selected = true) {
    
                  
                        zlist.insertBefore[0];
                        zlist.options.add(olist);
                    }
                }
            }
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2790
    Welcome to DevShed, matilem.

    = is an assignment operator.
    == is a comparison operator.
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.

IMN logo majestic logo threadwatch logo seochat tools logo