Javascript options.length

I am desparately trying do two things: 1) move a selected value from a drop down list into a multivalue field with javascript. 2) I want to double click on a value and remove it from the multivalue field with the following pieces of javascript;

function addItem(listId, textId) {

	var list = document.getElementById(listId);

	var text = document.getElementById(textId);

	list.options[list.options.length] = new Option(text.value, text.options[text.selectedIndex].value);

}

function removeItem(listId) {

	var list = document.getElementById(listId);

	list.options[list.selectedIndex] = null;

}

I can’t seem to get it right. Can someone tell me what I’m doing wrong - aside from trying to learn javascript at this late date that is…

Any help is appreciated,

Thanks

Subject: javascript options.length

Laura,

Did you add the functions to the onChange event of the drop down?

Shawn

Subject: javascript options.length

just try the following two pieces:

list.add(text.options[text.selectedIndex]);

and

list.remove(list.selectedIndex);