动态添加Select~

<script>
    var kindType=new Array()

</script>

<%
 '创建材料类别下拉框
 sql2="select * from material_kind_t where isvalid='1'"
 set rs2=server.createobject("ADODB.Recordset")
 rs2.open sql2,conn,1,1
 typeLen=rs2.recordcount
 '''response.Write(typeLen-1)
 do while not rs2.eof
%>

<script>

    kindType.push('<%=rs2.fields("kindName")%>') 
</script>

===============================================================

 kindLen1=document.all("supplierName").length-1
   if (kindLen1==0)
   {
    for(i=0;i<=kindType1.length-1;i++)  
     {
       var oOption=document.createElement("OPTION");  
       document.all("supplierName").options.add(oOption);  
       oOption.innerText =kindType1[i]  
       oOption.value=kindType1[i];
     }
   }else
    {
    ///alert(document.add_f.kindname.length);
    for(i=0;i<=kindType1.length-1;i++)  
     {
       var oOption=document.createElement("OPTION");  
       document.all("supplierName")[kindLen1].options.add(oOption);  
       oOption.innerText =kindType1[i]  
       oOption.value=kindType1[i];
       //alert(kindType[i])
     }
    }

posted @ 2011-03-29 22:39  AriLee  Views(275)  Comments(0Edit  收藏  举报