日期:2014-05-16 浏览次数:20454 次
<script type="text/javascript"> function getFileSize(fileObj) { //不能使用new Image,ie下报无dynsrc属性 var img1 = document.getElementById('img1'); img1.dynsrc=fileObj.value; //img1.fileSize:IE , fileObj.files[0].fileSize:chrome, fileObj.files[0].size:FF var size = img1.fileSize || fileObj.files[0].fileSize || fileObj.files[0].size; alert(size); } </script> <body> <INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this)"> <img id='img1' dynsrc=''/> </body>