代码如下: 在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>