hii
this is the code for the same
function moveToSelectedProjects()
{
domSwap(document.getElementById('projectList'), document.getElementById('selectedProjectList'));
}
function moveFromSelectedProjects()
{
domSwap(document.getElementById('selectedProjectList'), document.getElementById('projectList'));
}
// call the above two functions from your html page to move the item in the list
function domSwap(fromList, toList) {
// If nothing is selected then return
var selIndex = fromList.selectedIndex;
if(selIndex < 0) { return; }
// Prepare variables
var arrLookup = new Array(); // To quickly find the index of the text
var arrToList = new Array(); // To use JavaScripts builtin sort
var newToList = toList.cloneNode(false); // Only clone the parent
// Decrement to keep the changing index from affecting the moves
for(var i = fromList.length - 1; i >= 0; i--) {
arrLookup[fromList.options.item(i).text] = i;
if(fromList.options.item(i).selected) {
// Append to the toList unsorted initially
toList.appendChild(fromList.options.item(i));
}
}
}