fileupload組件之上傳與下載的頁面

來源:互聯網
上載者:User

標籤:pat   upload   page   lang   tab   title   att   scripts   javascrip   

<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><script type="text/javascript" src="${pageContext.request.contextPath }/scripts/jquery-1.7.2.js"></script><script type="text/javascript">        $(function(){                var i = 2;        //擷取#addFile,並為其添加click響應函數。        $("#addFile").click(function(){
    //當前節點(<td>)的父節點(<tr>)加上文本域。
    //before就是在什麼的前加上什麼。
         $(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(){
         //$(this)表示當前節點<button>。的父節點<td>的父節點<tr> var $tr = $(this).parent().parent(); $tr.prev("tr").remove(); $tr.remove(); //對 i 重寫排序 $(".file").each(function(index){ var n = index + 1; //td:first 表示<td>節點的第一個節點。 $(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 = i - 1; }); return false; }); }); </script></head><body> <font color="red">${message }</font> <br><br> <form action="fileuploadservlet" method="post" enctype="multipart/form-data"> <table> <tr class="file"> <td>File1:</td> <td><input type="file" name="file1"/></td> </tr> <tr class="desc"> <td>Desc1:</td> <td><input type="text" name="desc1"/></td> </tr> <tr> <td><input type="submit" id="submit" value="提交"/></td> <td><button id="addFile">新增一個附件</button></td> </tr> </table> </form></body></html>

 

fileupload組件之上傳與下載的頁面

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.