469,325 Members | 1,617 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,325 developers. It's quick & easy.

Getting Image Width/Height

Pls somebody give me the code for getting the height and width of a image in pixels in javascript or asp.

Thanks
- Emil
Dec 1 '06 #1
1 1643
acoder
16,027 Expert Mod 8TB
As an example
[HTML]<html>
<head>
<script type="text/javascript">
function getSize() {
var height = document.getElementById("image").height;
var width = document.getElementById("image").width;
alert("Height: "+height+ ", width: "+width);
}
</script>
</head>

<body>
<img id="image" src="whatever.gif">
<form>
<input type="button" onclick="getSize()" value="Get image size">
</form>
</body>

</html>[/HTML]
May 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Tjerk | last post: by
5 posts views Thread by Csaba Gabor | last post: by
1 post views Thread by Mustafa Rabie | last post: by
7 posts views Thread by chuck | last post: by
4 posts views Thread by tshad | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.