<!--#include file="conn.asp"--><html><title>图片批量上传系统</title><head>
<style type="text/css"> <!-- 
.tx1 { height: 20px; border: 1px solid #000000; font-size: 13px; font-style: normal; line-height: 13px; padding-top:3px; }
 --> </style> </head> 
<body onLoad="addfile()"> 
<form name="upload" method="post" action="upload.asp" enctype="multipart/form-data"> 
栏目:<%
set rs=server.CreateObject("adodb.recordset")
         sql = "select * from BigClass"
        rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目"
else
%>
<select name='BigClassName' size='1'><option selected value='<%=trim(rs("BigClassName"))%>'><%=trim(rs("BigClassName"))%></option><%
dim selclass
    selclass=rs("BigClassName")
         rs.movenext
    do while not rs.eof
%><option value='<%=trim(rs("BigClassName"))%>'><%=trim(rs("BigClassName"))%></option><%rs.movenext
loop
end if
rs.close
%></select><select name='SmallClassName'><option value='' selected>不指定小类</option><%
sql="select * from SmallClass where BigClassName='" & selclass & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%><option value='<%=rs("SmallClassName")%>'><%=rs("SmallClassName")%></option><% rs.movenext
do while not rs.eof%><option value='<%=rs("SmallClassName")%>'><%=rs("SmallClassName")%></option><%
    rs.movenext
loop
end if
        rs.close
%></select>
<input name="filenum" type="text" id="filenum" size="3"> 
<input type="button" onClick="addfile()" value="添加" class="tx1"> <input type=button onclick='delfile()'  value="删除"  class="tx1"> 
<div name="uptd" id="uptd"> </div> 
<input class="tx1" type="submit" value="开始上传" /> 
</form> 
<br> 
<div name="show" id="show"> </div> 
<script language="javascript">
function JSgetvalue(){
var xx=document.getElementById('filenum').value;
var oo='';
if(xx!=''&& parseInt(xx)>0){
for(var i=1;i<=xx;i++){
var zz=document.getElementById('info'+i).value;
if(zz!=''){  //只显示值不为空的项目.
var yy='info'+i+'的值是:'
oo=oo+yy+zz+'<br>';
}
}
document.getElementById('show').innerHTML=oo;
}
}
</script>
<script language="javascript"><!--
var k=0
function addfile(){
    var newTAB=document.createElement("table")    
    var n=parseInt(window.upload.filenum.value)
    if (!n ||n<1) n=1
    window.upload.filenum.value =n
    for (var i=1; i<=n;i++){
        k=k+1        
        var newTR=newTAB.insertRow()    
        var newTD1=newTR.insertCell()
        newTD1.valign='middle'
        newTD1.innerHTML="文件"+ k+":"
        newTD2=newTR.insertCell()
        newTD2.innerHTML="<input type='file' name='file"+k+"' class='tx1' value size='50'>说明:<input type='text' name='name"+k+"' size='10' class='tx1'>"
    }
    window.uptd.appendChild(newTAB)
}
//--></script>
<script language="javascript"><!--
function delfile(){
var tb=window.uptd.document.getElementsByTagName("table")
last_tb=tb[tb.length-1]
while (last_tb.rows.length<=0){window.uptd.removeChild(last_tb);last_tb=tb[tb.length-1]}
last_tb.deleteRow()
k--
}
//--></script>
</body>
</html>主要问题:想把栏目选择放入到每个图片说明的后面,以供选择,直接放过去,不能实现。
是不是有下拉菜单的的不能放每一列的后面呢?
另外还有一个问题,就是,点删除时,可以删到一行都不剩余。能否至少保留一行。

解决方案 »

  1.   

    点删除时,可以删到一行都不剩余。能否至少保留一行。
    <script language="javascript"><!--
    function delfile(){
    if (k<=1){alert("不能再删了^_^");return}
    var tb=window.uptd.document.getElementsByTagName("table")
    last_tb=tb[tb.length-1]
    while (last_tb.rows.length<=0){window.uptd.removeChild(last_tb);last_tb=tb[tb.length-1]}
    last_tb.deleteRow()
    k--
    }
    //--></script>
      

  2.   

    问题已解决,原来是我的ASP代码是有空格的原因,谢谢各位的回答