javascript - Unable to Move the List of values from Right Combo bx to Left Combo bx (Multiple List of values) -


function listbox_moveacross(sourceid, destid) {     var src = document.getelementbyid(sourceid);     var dest = document.getelementbyid(destid);     var errcount = 0;     (var count = 0; count < src.options.length; count++) {         if (src.options[count].selected == true) {             var option = src.options[count];             var newoption = document.createelement("option");             newoption.value = option.value;             newoption.text = option.text;             newoption.selected = true;             try {                 dest.add(newoption, null); // standard                 src.remove(count, null);             } catch (error) {                 dest.add(newoption); // ie                          src.remove(count);             }             count--;             errcount++;         }     }     if (errcount == 0) {         alert("no element selected or have no element move");     } } 

hi can body on javascript given code moving list of values right left , left user can select multiple values in given list in case unable move list of values right left working fine left right

try removing count--; code have feeling preventing loop moving onto next iteration if finds selected item in list.

seems work fine me:

http://jsfiddle.net/xbdkg/


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -