moving options from one listbox to another

A

ashkaan57

Hi,
I have two listboxes and want to move a set of selcted items from the
listbox on the left moved to the listbox on the right when a button is
pressed:

function RightButton_OnClick()
{
alert('Clicked MOVE button...');

var AvailableLB = document.getElementById("available");
var LinkedLB = document.getElementById("linked");

for (var i=0; i < AvailableLB.length; i++) {
if (AvailableLB.options.selected == true) {
LinkedLB.options[LinkedLB.length] =
new Option(AvailableLB.options.text,
AvailableLB.options.value);
AvailableLB.options = null;
i=i-1;
}
}
return;
}

<select name="available" multiple size="8" id="available">
</select>

<input name="move" type="button"
value=">>",onClick="RightButton_OnClick();">

<select multiple name="linked" size="8" id="linked">
</select>


When I click on the button, nothing.... not even a javascript error
message or the alert I put at the begining.

Your help is much appreciated.
 
L

lorinho

<input name="move" type="button"
value=">>",onClick="RightButton_OnClick();">

Could that comma between your value and onClick attributes be the
problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top