Hopes

          Start Here..

           

          文件大小超過5M給提示不讓上傳


          var Sys = {};
          if(navigator.userAgent.indexOf("MSIE")>0) {
          Sys.ie=true;
          }
          if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
          Sys.firefox=true;
          }
          if(isFirefox=navigator.userAgent.indexOf("'Chrome")>0){
          Sys.firefox=true;
          }
          if(isFirefox=navigator.userAgent.indexOf("'Opera")>0){
          Sys.firefox=true;
          }
          //清空上傳文件大小超過5M給提示不讓上傳
          function checkFileChange(obj) {
          var filesize = 0;
          if(Sys.firefox){
          filesize = obj.files[0].fileSize;
          }else if(Sys.ie){
          var filePath = obj.value;
          var image=new Image();
          image.dynsrc=filePath;
          filesize=image.fileSize;
          }
          if (filesize>5*1024*1024)//大于5M
          {
          window.alert('More than 5M,Please Try again!');
          clearFileInput(obj);
          return false;
          }
          }
          //清空驗證后的fileupload控件內容
          function clearFileInput(file){
          var form=document.createElement('form');
          document.body.appendChild(form);
          var pos=file.nextSibling;
          form.appendChild(file);
          form.reset();
          pos.parentNode.insertBefore(file,pos);
          document.body.removeChild(form);
          }

          posted on 2012-11-08 15:07 ** 閱讀(1444) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          公告

          你好!

          常用鏈接

          留言簿(2)

          隨筆檔案

          文章分類

          文章檔案

          新聞檔案

          相冊

          收藏夾

          C#學習

          友情鏈接

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 和硕县| 寿阳县| 霍山县| 四子王旗| 宁晋县| 上饶县| 栾城县| 永春县| 叶城县| 当涂县| 定远县| 揭东县| 合山市| 九龙县| 龙州县| 荣昌县| 无棣县| 龙口市| 常熟市| 武安市| 叶城县| 宜君县| 什邡市| 美姑县| 诸城市| 南宫市| 封开县| 阿鲁科尔沁旗| 保康县| 临邑县| 汽车| 防城港市| 青岛市| 苗栗市| 鹰潭市| 义马市| 普洱| 庆云县| 青岛市| 昭通市| 金平|