Javascript Help: IMG (Image) Object
JavaScript can be used to access a number of DOM (Document Object Model)
Objects. One very common object is the IMG (Image) tag/object.
Here are it's properties and methods enumerated dynamically.
(Note: this method will expose the properties and methods supported by your browser on-the-fly.)
The Image Object is the JavaScript object for interfacing with IMG tags.
The properties you see between <img> HTML markup map to similar property names that are a part of the
DOM and become accessible to client-side scripting.
Note: while the IMG tag's SRC property can technically request many types of image formats, the
properties appear to belong to the IMG tag rather than to the format of the image type as evidenced by the
enumerated properties of three test IMG tag instances.
See below for additional detail.
GIF Image Object Properties Enumerated
JPG Image Object Properties Enumerated
PNG Image Object Properties Enumerated
Tip:
This example uses a small script library to expose the properties and methods
of a passed object. You can use it from where it lives on the web during your own
development, or download it and tweak to suite your needs.
View the source of expose.js for additional info.
Here's an example of it's usage:
Other Popular and Related Resources
Related Keywords: javascript, img, image, object, expose, method, DOM attributes for image object