[code=HTML
<html>
<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">
<input type="hidden" name="filenum" id="filenum">
<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="vbscript">
dim str,k
k=1
function addfile()
dim str
str="<table>"
if not IsNumeric(window.upload.filenum.value) then window.upload.filenum.value =1
for i=1 to window.upload.filenum.valuestr=str&"<tr><td valign='middle'>文件"&k&":</td><td><input type='file' name='file"&k&"' class='tx1' value size='50'>说明:<input type='text' name='name"&k&"' size='10' class='tx1'></td></tr>"
k=k+1
next
window.uptd.innerHTML =window.uptd.innerHTML & str&"</table>"
end function
</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>
[/code]
当我从浏览里放选择了几张图片后,再按添加,原来我选的那几个就会不见了,请问怎么使期不丢失。
<html>
<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">
<input type="hidden" name="filenum" id="filenum">
<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="vbscript">
dim str,k
k=1
function addfile()
dim str
str="<table>"
if not IsNumeric(window.upload.filenum.value) then window.upload.filenum.value =1
for i=1 to window.upload.filenum.valuestr=str&"<tr><td valign='middle'>文件"&k&":</td><td><input type='file' name='file"&k&"' class='tx1' value size='50'>说明:<input type='text' name='name"&k&"' size='10' class='tx1'></td></tr>"
k=k+1
next
window.uptd.innerHTML =window.uptd.innerHTML & str&"</table>"
end function
</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>
[/code]
当我从浏览里放选择了几张图片后,再按添加,原来我选的那几个就会不见了,请问怎么使期不丢失。
test:<html><head></head>
<body>
<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">
<input type="hidden" name="filenum" id="filenum">
<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>
小改:<html><head><script language="javascript">
<!--
var k=0
function addfile(){
k++
var newTAB=document.createElement("table")
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.upload.filenum.value =k
window.uptd.appendChild(newTAB)
}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--
window.upload.filenum.value =k
}
//-->
</script><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">
<input type="hidden" name="filenum" id="filenum">
<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></body>
</html>