程式碼如下: 在ie下,看似要改安全設定中的【對為標記為可安全執行腳本的ActiveX空間初始化並執行】那項 複製程式碼 程式碼如下: <BR>var isIE = /msie/i.test(navigator.userAgent) && !window.opera; <BR>function fileChange(target) { <br><br>var fileSize = 0; <BR>if (isIE && !target .files) { <BR>var filePath = target.value; <BR>var fileSystem = new ActiveXObject("Scripting.FileSystemObject"); <BR>var file = fileSystem.GetFile (filePath); <BR>fileSize = file. Size; <BR>} else { <BR>fileSize = target.files[0].size; <BR>} <BR>alert(“檔案位元組大小:” fileSize); <BR>var size = fileSize / 1024 ; <BR>if(size>10000){ <BR>alert("附件不能大於10M"); <br><br><BR>} <br><br>} <BR> } }