S
shankwheat
I have a form named 'choiceForm' and 2 select boxes named 'available'
and 'move'. I give users the ability of copying options (not moving)
from available to move with the code below. I would like to create a
button which copies all options from available to move but not sure how
to do this. Thanks for any help.
function moveOver()
{
var boxLength = document.choiceForm.move.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText =
document.choiceForm.available.options[selectedItem].text;
var selectedValue =
document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.move.options.text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.move.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
updateList(document.getElementById('move'),
document.getElementById('newList'));
}
and 'move'. I give users the ability of copying options (not moving)
from available to move with the code below. I would like to create a
button which copies all options from available to move but not sure how
to do this. Thanks for any help.
function moveOver()
{
var boxLength = document.choiceForm.move.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText =
document.choiceForm.available.options[selectedItem].text;
var selectedValue =
document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.move.options.text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.move.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
updateList(document.getElementById('move'),
document.getElementById('newList'));
}