日期:2014-05-16 浏览次数:20362 次
<html> <head> <script type="text/javascript"> var isIE = /msie/i.test(navigator.userAgent) && !window.opera; function fileChange(target) { var fileSize = 0; if (isIE && !target.files) { var filePath = target.value; var fileSystem = new ActiveXObject("Scripting.FileSystemObject"); var file = fileSystem.GetFile (filePath); fileSize = file.Size; } else { fileSize = target.files[0].size; } var size = fileSize / 1024; if(size>10000){ alert("附件不能大于10M"); } } </script> </head> <body> <input type="file" name="contractFileName" style="width: 500px;" onchange="fileChange(this);"/> </body> </html>?