Asked by garysamuels
at 2024-07-25 08:09:24
Point:500 Replies:2 POST_ID:829105USER_ID:10
Topic:
JavaScript;jQuery;Hypertext Markup Language (HTML)
I need to know the width of an image before it is called in the html source. I know the name of the image and I'm trying to use javascript to discover the width. This returns a vale of 0 for the width.
var img = new Image();
img.src = "http://mysite.com/graphics/myimage.png"
window.confirm(img.width);
var img = new Image();
img.src = "http://mysite.com/graphics/myimage.png"
window.confirm(img.width);