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">

 

  程序猿必读

posted on 2016-07-28 17:31  龙种人  阅读(13413)  评论(1编辑  收藏  举报