zoukankan      html  css  js  c++  java
  • javascript

    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();
     } 
    }

  • 相关阅读:
    PRCT-1302 the OCR has an invalid ip address
    函数listen
    函数bind
    函数socket
    lamp。查看版本
    yii 日期插件
    UCenter 的目录结构
    API接口
    返回标签数据示例 (PHP)
    应用接口函数
  • 原文地址:https://www.cnblogs.com/kevinge/p/1402090.html
Copyright © 2011-2022 走看看