PDA

View Full Version : How to get W and H of an Img


anakintang
08-13-2004, 12:56 PM
in JavaScript I want to get the width and height of an image online (through url) before I put it on my HTML, how can I do it? Thanks

agent002
08-13-2004, 01:05 PM
something like this?
<script>

window.onload = function(){
alert('width: '+loadImage.width+', height: '+loadImage.height);
}

var loadImage = new Image();
loadImage.src = 'image.jpg';

</script>