CFXIXI工作室首页
CF西西的博客 | 如何使用javascript获得img的height和width

如何使用javascript获得img的height和width

26. 四月 2013

How to get image size (height & width) using javascript?

使用clientHeight

转自:http://stackoverflow.com/questions/623172/how-to-get-image-size-height-width-using-javascript

var img = document.getElementById('imageid'); 
//or however you get a handle to the IMG
var width = img.clientWidth;
var height = img.clientHeight;

javascript