html有关多个文件上传

来源:百度知道 编辑:UC知道 时间:2024/05/09 11:18:56
为什么补充文件了,上传框却不会自动增加一个呢?
原理好像没有错哦

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<script type="text/javascript">

function imgChange(next) {
if(next != null)
next.style.display = "";
}

function validate() {
var phos = 2;
for(i = 0; i < 2; i++) {
if($("del" + i).checked == true)
phos--;
}
for(i = 0; i < 4; i++) {
if($("photoFile" + i).value != "")
phos++;
}
if(phos > 4) {
alert("图片太多,您最多总共可以保存4张图片!");
return false;
}
return true;
}
</script>

<form action="/addTrade.do" method="post" enctype="multipart/form-data" onSubmit="return validate()">

//改好了没问题..加文件试试
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<script type="text/javascript">

function imgChange(next) {
if(next != null)
document.getElementById(next).style.display = "";
}

function validate() {
var phos = 2;
for(i = 0; i < 2; i++) {
if($("del" + i).checked == true)
phos--;
}
for(i = 0; i < 4; i++) {
if($("photoFile" + i).value != "")
phos++;
}
if(phos > 4) {
alert("图片太多,您最多总共可以保存4张图片!");
return false;
}
return true;
}
</script>

<form action="/addTrade.do" method="post" enctype="multipart/form-data" onSubmit="return validate()">
<!-- 上传照片-->
<div>

<table width="100%" border="