关于javascript判断文件大小

canca canca
2008-08-13 12:53
2
0



Javascript代码
  1. <script type="text/javascript">   
  2. function getFileSize(filePath)   
  3. {   
  4.    var fso = new ActiveXObject("Scripting.FileSystemObject");   
  5.    alert("文件大小为:"+fso.GetFile(filePath).size);   
  6. }   
  7. </script>   
  8. <body>   
  9. <INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this.value);">   
  10. </body>  
<script type="text/javascript"> function getFileSize(filePath) { var fso = new ActiveXObject("Scripting.FileSystemObject"); alert("文件大小为:"+fso.GetFile(filePath).size); } </script> <body> <INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this.value);"> </body> 


不推荐,也不多说

src,dynsrc,start,alt,controls,loop,loopdelay,hspace,vspace....



fileCreatedDate、fileModifiedDate、fileSize、fileUpdatedDate、filters...

Javascript代码
  1. <script type="text/javascript">   
  2. function getFileSize(filePath)   
  3. {   
  4.    var image=new Image();   
  5.    image.dynsrc=filePath;   
  6.    alert(image.fileSize);   
  7. }   
  8. </script>   
  9. <body>   
  10. <INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this.value)">   
  11. </body>  
<script type="text/javascript"> function getFileSize(filePath) { var image=new Image(); image.dynsrc=filePath; alert(image.fileSize); } </script> <body> <INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this.value)"> </body> 


推荐,没的说

发表评论