Javascript examples for DOM HTML Element:Image
Get the width and height of a dynamically loaded image
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/* w ww . j av a2s . co m*/ var img = new Image(); img.onload = function(){ console.log('Width: ' + img.width +', Height: ' + img.height); } img.src = 'http://www.google.com/images/logos/ps_logo2.png'; }); </script> </head> <body> </body> </html>