隨筆 - 7  文章 - 3  trackbacks - 0
          <2013年5月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          常用鏈接

          留言簿

          隨筆檔案

          文章分類

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

               摘要: 首先我們需要一個被加載的js文件,我在一個固定文件夾下創建了一個package.js,打開后在里面寫一個方法functionOne,很簡單,代碼如下:function functionOne(){ alert("成功加載"); }后面的html文件都創建在同一個目錄下。方法一:直接document.write在同一個文件夾下面創建一個function1.html,代碼如下:<ht...  閱讀全文
          posted @ 2013-06-01 09:19 Tomas 閱讀(400) | 評論 (0)編輯 收藏


          多文件上傳 jquery的插件
          使用的方法  導入 jquery.js 及 jquery.MultiFile.js ,
          方式一: 后臺是文件數組  
           private File[] upload; // 與jsp表單中的名稱對應
           private String[] uploadFileName;
           private String[] uploadContentType;
          在 form 中加入 <input type="file" name="upload[]" class="multi" /> 即可。

          方式二:后臺是List<File>
           private List<File> upload; // 與jsp表單中的名稱對應
           private List<String> uploadFileName;
           private List<String> uploadContentType;

          jquery.MultiFile.js  將選中的文件列在From中,名字為upload的<input>,所以要用 name="upload[]"(方法一)或者name="upload" (方法二) 來接收
          class="multi" 是 jQuery 用來作的文件類型,HTML 部份代碼如下:

          <head>
          <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
          <title>Untitled Document</title>
          <script src="/multiple-file-upload/jquery.js" type="text/javascript" language="javascript"></script>
          <script src="/multiple-file-upload/jquery.MultiFile.js" type="text/javascript" language="javascript"></script>

          </head>
          <body>

          <form enctype="multipart/form-data" action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
          <input type="file" name="upload[]" class="multi" maxlength="2"/>
          //<input type="file" name="upload" class="multi" />

          <input type="submit" value="Upload File" />
          </form>

          </body>

          參數說明:

          參數 說明 說明
          class="multi" maxlength="2" Limit: 2 files.
          Allowed extensions: any.
          限制數量2
          class="multi" accept="gif|jpg" Limit: no limit.
          Allowed extensions: gif and jpg.
          格式只能 gif  jpg
          class="multi" accept="gif|jpg" maxlength="3" Limit: 3 files
          Allowed extensions: gif, jpg.
          限制數量3,格式只能 gif  jpg


          主頁:http://www.fyneworks.com/jquery/multiple-file-upload/

          下載:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Download

          示例:http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Examples

          posted @ 2013-05-17 15:56 Tomas 閱讀(4191) | 評論 (2)編輯 收藏
          主站蜘蛛池模板: 定兴县| 和龙市| 峨山| 平谷区| 那坡县| 绥德县| 普格县| 福安市| 凤冈县| 山阴县| 通许县| 无锡市| 闽侯县| 梧州市| 罗平县| 称多县| 鄂尔多斯市| 澄江县| 稻城县| 凯里市| 县级市| 洛扎县| 兴安县| 浮梁县| 溧水县| 安平县| 金阳县| 天台县| 隆化县| 大英县| 安义县| 华池县| 遂平县| 涿州市| 电白县| 景东| 鄂托克旗| 温宿县| 昌图县| 无棣县| 石阡县|