var MyTest = document.getElementById("upload_img").files[0];
var reader = new FileReader(); reader.readAsDataURL(MyTest); reader.onload = function(theFile) {   var image = new Image(); image.src = theFile.target.result; image.onload = function() {   alert("图片的宽度为"+this.width+",长度为"+this.height); }; };

其中,id为“upload_img”的标签如下:

<input type="file" size="20" autocomplete="off" id="upload_img" name="Uploadfile">

 

  程序猿必读

相关文章:

  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2021-10-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
相关资源
相似解决方案