<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html><html><head><metacharset="UTF-8"><title>Insert title here</title><scripttype="text/javascript"src="${pageContext.request.contextPath }/scripts/jquery-1.7.2.js"></script><scripttype="text/javascript">$(function(){var i =2;$("#addFile").click(function(){$(this).parent().parent().before("<tr class='file'><td>File"+ i +":</td><td><input type='file' name='file"+ i +"' /></td></tr><tr class='desc'><td>Desc"+ i +":</td><td><input type='text' name='desc"+ i +"' /><button id='delete"+ i +"'>删除</button></td></tr>");
i++;$("#delete"+(i -1)).click(function(){var $tr =$(this).parent().parent();
$tr.prev("tr").remove();
$tr.remove();$(".file").each(function(index){var n = index +1;$(this).find("td:first").text("File"+ n);$(this).find("td:last input").attr("name","file"+ n);});$(".desc").each(function(index){var n = index +1;$(this).find("td:first").text("Desc"+ n);$(this).find("td:last input").attr("name","desc"+ n);
i =++n;});});returnfalse;});});</script></head><body><fontcolor="red">${message }</font><formaction="uploadServlet"method="post"enctype="multipart/form-data"><table><trclass="file"><td>File1:</td><td><inputtype="file"name="file1"/></td></tr><trclass="desc"><td>Desc1:</td><td><inputtype="text"name="desc1"/></td></tr><tr><td><inputtype="submit"id="submit"value="提交"/></td><td><buttonid="addFile">新增一个附件</button></td></tr></table></form></body></html>