Click to See Complete Forum and Search --> : Images
Cool Javascript
05-28-2004, 01:58 PM
is there any way of javascript telling how big an image is? - that is e.g. if the height is not specified in the <img> tag, but depends upon what image is loaded into the src. Or if not, is it possible that I can specify in the name of the source how big it is, which java script can then look for in the name, to find out how big it is?
thanks
gil davis
05-28-2004, 06:54 PM
Once the image has been loaded, javascript can get the width and height of it. You can even change it.
starrwriter
05-31-2004, 04:14 AM
Originally posted by gil davis
Once the image has been loaded, javascript can get the width and height of it. You can even change it.
Can you post the script that will do that?
Through the images array:
document.images[0].height
or it's id:
document.getElementById('myimage').style.height