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

  • 相关阅读:
    Python3——爬取淘宝评论
    python爬虫 URL分析
    python3爬取网页图片
    python_2 / python_3 区别与安装问题
    vue.$nextTick 解决了哪些问题
    Vue 路由缓存
    vue elementui form表单验证
    Hadoop Hive sql 语法详解
    sql server, mysql, oracle平时用法的区别
    Excel中值得收藏的12个函数公式
  • 原文地址:https://www.cnblogs.com/kevinge/p/1402090.html
Copyright © 2011-2022 走看看