the parameter obj, devobj are object, not string
function to2(obj,devobj)
{
var tmp = obj.id;
var deviceid = devobj.id;
idlistbox = tmp.substring(0,(tmp.length-1));
var list1 = document.getElementById(idlistbox+'1');
var list2 = document.getElementById(idlistbox+'2');
//get device description
var device = document.getElementById(deviceid);
var deviceDes = device.options[device.selectedIndex].text;
var indice1 = list1.selectedIndex;
var sizeList2 = list2.length;
if (indice1 < 0)
{
alert(document.getElementById("nullselected").value);
return;
}
var a = list1.options[indice1];
var b = list2.options[sizeList2];
var iscontained = false;
for (i=0;i<sizeList2;i++)
{
if (list2.options[i].value==a.value)
{
alert(document.getElementById("doubleElement").value);
iscontained = true;
break;
}
}
if (iscontained==false)
{
try
{
var oOption = document.createElement("OPTION");
oOption.text=deviceDes+"->"+a.text;
oOption.value=a.value;;
list2.add(oOption,b);
list1.remove(indice1);
}
catch (e1)
{
var oOption = document.createElement("OPTION");
oOption.text=deviceDes+"->"+a.text;
oOption.value=a.value;;
list2.add(oOption);
list1.remove(indice1);
}
list2.selectedIndex=sizeList2;
list2.focus();
}
}