function moveSelectedItems(fromList, toList) {
moveOneWay(fromList, toList);
}
function moveOneWay(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrFvalues = new Array();
var arrTvalues = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrTvalues[i] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
arrTvalues[tLength] = fbox.options[i].value;
tLength++;
}
}
tbox.length = 0;
var c;
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrTvalues[c];
no.text = arrTbox[c];
tbox[c] = no;
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i am not quite sure how to simulate the situation
----- list A -------- --------- list B ---------
user A
user B
------------------- ------------------------
button: ADD button: REMOVE
when you click ADD user A is moved from list A to list B. List A will no longer have user A.
I hope this would clarify the situation, thx for reading guys.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
guys, i am trying to simulate clicking on a javascript button that moves an item from one list to another list.
<a href="javascript:moveSelectedItems(document.report.fromList, document.report.toList)"><img src="../images/b-addList.gif"></a>
function moveSelectedItems(fromList, toList) {
moveOneWay(fromList, toList);
}
function moveOneWay(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrFvalues = new Array();
var arrTvalues = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrTvalues[i] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
arrTvalues[tLength] = fbox.options[i].value;
tLength++;
}
}
tbox.length = 0;
var c;
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrTvalues[c];
no.text = arrTbox[c];
tbox[c] = no;
}
}
i am not quite sure how to simulate the situation
----- list A -------- --------- list B ---------
user A
user B
------------------- ------------------------
button: ADD button: REMOVE
when you click ADD user A is moved from list A to list B. List A will no longer have user A.
I hope this would clarify the situation, thx for reading guys.