首頁  >  文章  >  web前端  >  如何使用JS取得IE上傳檔案路徑(IE7,8)_javascript技巧

如何使用JS取得IE上傳檔案路徑(IE7,8)_javascript技巧

WBOY
WBOY原創
2016-05-16 17:29:371540瀏覽
複製程式碼 程式碼如下:

function validate ent .getElementById("Button2");
            btnsave.disabled = false;
       fileupload = document.getElementById(id);
            if (fileupload.value.length             var agent = window.navigator.userAgent;
            var isIE7 = agent.indexOf('MSIE 7.0') != -1;
                var isIE8 = agent.indexOf('MSIE 8.0') ! 🎜>                if (isIE7 || isIE8) {
                    fileupload.select();
                    filepath = document.selection.createRange().text;
                }
                //IE6獲得文件路徑
                else
                { filepath = file.value ; }
                //PageMethods.ValidateFile(filepath, maxsize, ieCallBack);
  path;        }
            if (agent.indexOf("Firefox") >= 1) {
                alert("FF");
               alse;
                if (fileupload.files) {
          🎜>                   nerHTML = ' ';
                        alert時("檔案超過大小! ");
                    }
                       }
            }
       
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn