rgbtdkjcel 发表于 2007-12-18 15:55

下列代碼為何無效??

function changenext()
         {
           var select1=document.getElementById("selectcompany");
           var select2=document.getElementById("selectdept");
           var cobalt1dep=new Array("前台","經理室","國內市場部","行政部","資訊組","倉庫","塑膠部","裝備一部","裝備二部","品質部","採購部","PMC","工程部(樣板組)","工程部","工模部","生產總部","財務部","移噴部");
           var cobalt2dep=new Array("行政","工程","工程IE組","BOM","品質部","引線部","工程部","裝備三部","倉庫","喇叭","海棉");
           var hkdep=new Array("administration","acounting","sale&marketing","shipping","R&D","conference","國內廠專線電話");
          switch (select1.options[select1.selectedIndex].value)
          {
          case "高寶一廠":
            for (i=0;i<cobalt1dep.Length ;i++ )
            {
                  alert(i);
                 var o=new option(cobalt1dep[0],cobaltdep[0]);
                  select2.appendChild(o);
            }
             
          case "高寶二廠":
               for (i2=0;i2<cobalt2dep.Length ;i2++ )
            {
                  var e1=document.createElement("option");
                  alert(e1);
                  e1.text=cobalt1dep[i2];
                  e1.value=cobalt1dep[i2];
                  select2.appendChild(e1);
            }
          case "香港":
             
          }
          }

渚薰 发表于 2007-12-18 16:01

cobalt1dep.Length
Length小写
cobalt1dep.length

select2.appendChild(o);

select2.options.push(o)

页: [1]

编程论坛