moving options from one select list to another.
I wanted to know if I could move options from one select list to another by using document.getElementById instead of using sel and other methods.
I just wish to directly call one particular select list. because I worried that all these select list scripts don't work when there are more than two select list on a page.
I have a nice script I want to modify but I don't understand. selfrom and selto
I never see anything that points to my select list's ID, class or name.
however the code works. Can some one help me understand what is happening?
Code:
function moveOptions(theSelFrom, theSelTo)
{
var selLength = theSelFrom.options.length;
for(var i=0; i<selLength; i++)
{
if(theSelFrom.options[i].selected)
{
if (!addOption(theSelTo, theSelFrom.options[i].text, theSelFrom.options[i].value)){
theSelFrom.options[i].selected = false; //remove selection if not duplicate and added
}