<!--#include file='sel.asp'-->
直接这样写不行吗

解决方案 »

  1.   

    客户端脚本不能调用服务器端脚本
    页面加载的时候初始化一行,如果不需要就把它隐藏,然后clone这一行就可以了
      

  2.   

    你可以只初始化一个,然后复制啊
    <html>
    <head>
    <title>code by meixx</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script language="javascript">
    var curRow=null;
    function selectRow(tr1){
    if(curRow)
    curRow.bgColor="#FFFFFF";
    tr1.bgColor="e7e7e7";
    curRow=tr1;
    }
    function addRow(src){
    var newrow = src.insertRow(src.rows.length-1);
    newrow.attachEvent("onclick",function(){selectRow(newrow);});
    newrow.height=20;
    var i=4;
    while(i--){
    var newcell = newrow.insertCell();
    switch(i){
    case 0: newcell.innerHTML= '<input type="button" onClick="javascript:delRow(this.parentElement.parentElement)" value="删除此行">';break;
    default: newcell.innerHTML=div1.innerHTML;break;
    }
    }
    }
    function delRow(src){
    src.parentElement.deleteRow(src.rowIndex);
    }
    </script>
    </head><body>
    <table id="tb" width="100%"  border="1" align="center" cellpadding="1" cellspacing="1" style="border-collapse:collapse" bordercolor="#111111">
      <tr>
        <th scope="col" width="25%">一</th>
        <th scope="col" width="25%">二</th>
        <th scope="col" width="25%">三</th>
        <th scope="col" width="25%">四</th>
      </tr>
      <tr id="blankRow" onClick="addRow(this.parentElement)">
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <div id="div1" style="display:none "><select id="txt" style="width:97%; background-color:#FFFFEF"><option>test</option></select></div>
    </body>
    </html>
    就像用这种方法
      

  3.   

    zhaoxiaoyang(梅雪香@hisoft)好人帮到底,请问包含进的二级联动该怎么区别他们,并分别取得他们的对象?现在按照你的方法复制后,一个文件里面多个联动,所有的属性和对象都重复了。联动就无法选择了。
    :(
      

  4.   

    <%
    'dim count
    set rst=Server.CreateObject("ADODB.Recordset")
    rst.open "select pdid,tblprodeailinfo.pid,pdno,pdmemo,tblprodeailinfo.opid,tblprodeailinfo.optime,tblprojectinfo.proname,prono from tblprodeailinfo left join tblprojectinfo on tblprojectinfo.pid=tblprodeailinfo.pid",con,1,1
    %>
    <script language="JavaScript">
    <!--
    var onecount;
    onecount=0;
    subcat = new Array();
    <%
       count = 0
       do while not rst.eof 
    %>
    subcat[<%=count%>] = new Array("<%= trim(rst("pdno"))%>","<%=trim(rst("pid"))%>","<%= trim(rst("pdid"))%>","<%=trim(rst("proname"))%>","<%=trim(rst("prono"))%>","<%=trim(rst("optime"))%>");
    <%
            count = count + 1
            rst.movenext
            loop
            rst.close
    %>

    onecount=<%=count%>;
    function changelocation(locationid)
        {
       alert("eeeeeeeeeeeeee");
        //取得选择的公司id
       alert(locationid)
        ucompid="";
       cid=document.form1.anclassid.options[document.form1.anclassid.selectedIndex].value.replace(/(^\s*)|(\s*$)/ig,"");
          document.form1.selcompid.value=cid
    if (cid==""){        return false;  } // alert (cid)
        
        document.form1.Nclassid.length = 0; 
        
        var locationid=locationid;
        var i;
        for (i=0;i < onecount; i++)
            {
           // alert (onecount)            if (subcat[i][1] == locationid)
                { 
                 newOption1=new Option(subcat[i][0], subcat[i][2])
                 
                 document.all.Nclassid.add(newOption1)
                
                } 
               if (subcat[i][1] == cid)
                 {
                 //alert ("ok2");
                 document.form1.seldeptid.value="";
                
                } 
          }  
        }  
    -->
    </script><%'Dim sqlText,sqlText1%>
      <TABLE style="TABLE-LAYOUT: fixed" width=230 cellSpacing=0 cellPadding=0 border=0 height=23>   <tr bgcolor="#FFFFFF">
       
         
            <%'Dim tempValue
      sqlText="select pid,prono,proname from tblprojectinfo "
      'Response.Write sqltext
    %>
          <TD id=oINNER bgColor=#f7f8f9 valign=top>&nbsp;<input type="hidden" id="selcompid" name="selcompid" size=2 value="<%if len(ucompid)>0 then Response.Write ucompid else Response.Write "" end if%>">
          <select name="anclassid" size="1" id="anclassid" onChange="alert('en');changelocation(document.form1.anclassid.options[document.form1.anclassid.selectedIndex].value)" style="border:0px solid #000000; FONT-FAMILY: 宋体; FONT-SIZE: 9pt;color:#000000; background-color:#ffffff" >
            
              
              <% rst.open sqlText,con,1,1
      If Not (rst.eof And rst.bof) Then
       tempValue=rst("pid")
       While Not rst.eof 
        
        
       
     %>
              <option value="<%=trim(rst("pid"))%>" ><%=trim(rst("proname"))%></option>
              <%
       rst.movenext
       Wend
       End If
       rst.close
     %>
          </select>
          <%
          sqlText="select pdid,pid,pdno from tblprodeailinfo"
             
              sqlText=sqlText+" Where pid='" & tempValue & "'"
              
              'Response.Write sqltext%>
         
        
        
         <TD id=oINNER bgColor=#f7f8f9 valign=top>&nbsp;<input type="hidden" id="seldeptid" size=2 name="seldeptid" value="<%if len(udeptid)>0 then Response.Write udeptid else Response.Write "" end if%>">
           <select name="Nclassid" onchange="seldept();" style="border:0px solid #000000; FONT-FAMILY: 宋体; FONT-SIZE: 9pt;color:#000000; background-color:#ffffff" >
              
              <%
      rst.open sqlText,con,1,1
     '  Response.Write udeptid & ","& rst("deptid") &"<br>"
      If Not (rst.eof And rst.eof) Then    
       while not rst.eof 
      %>
              <option value="<%=trim(rst("pdid"))%>" <%if cstr(ufluxid)=cstr(trim(rst("pid"))) then Response.Write "selected" end if%>><%=trim(rst("pdno"))%></option>
              <%rst.movenext
      wend   
      End If
      rst.close
      set rst=nothing
    %>
          </select>
      
      </TR>
     </table>
      

  5.   

    可以把联动的脚本改一改,用event.srcElement来获取当前操作的select对象,用event.srcElement的parentElement.children集合来检索第二个select