IMG | NN 3 IE 4 DOM 1 | ||||
The IMG object reflects the IMG element. | |||||
HTML Equivalent<IMG> | |||||
Object Model Reference
|
align | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Defines how the element is aligned relative to surrounding text content. Most values set the vertical relationship between the element and surrounding text. For example, to align the bottom of the element with the baseline of the surrounding text, the align property value would be baseline. An element can be "floated" along the left or right margin to let surrounding text wrap around the element. | |||
Exampledocument.logoImg.align = "absmiddle" | |||
Value Any of the following alignment constant values (as a string): absbottom | absmiddle | baseline | bottom | right | left | none | texttop | top. | |||
|
alt | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Text to be displayed where the IMG element appears on the page when a browser does not download graphics (or is waiting for the image to download). The text is usually a brief description of what the image is. Be aware that the size of the image area on the page may limit the amount of text you can assign to the alt property. Make sure the description is readable. | |||
Exampledocument.corpLogo.alt = "MegaCorp Logo" | |||
Value Any quoted string of characters. | |||
|
border | NN 3 IE 4 DOM 1 | ||
Read/Write (IE) | |||
Thickness of the border around an element (in pixels). While Internet Explorer 4 draws a border around an existing image when you change this property, the property is read-only in Navigator 4. | |||
Exampledocument.logoImage.border = 4 | |||
Value An integer value. A setting of zero removes the border entirely in Internet Explorer 4. | |||
|
complete | NN 3 IE 4 DOM n/a | ||
Read-only | |||
Reveals whether the IMG element's SRC image file has fully loaded. Note that Navigator 4 provides an incorrect true reading before the image has completely loaded. | |||
Exampleif (document.logo.complete) { } | |||
Value Boolean value: true | false. | |||
|
dataFld | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to associate a remote data source column name with the src property of the IMG object. A DATASRC attribute must also be set for the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.myImage.dataFld = "linkURL" | |||
Value Case-sensitive identifier of the data source column. | |||
|
dataSrc | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
Used with IE 4 data binding to specify the name of the remote ODBC data source (such as an Oracle or SQL Server database) to be associated with the element. Setting both the dataFld and dataSrc properties to empty strings breaks the binding between element and data source. | |||
Exampledocument.myImage.dataSrc = "#DBSRC3" | |||
Value Case-sensitive identifier of the data source. | |||
|
dynsrc | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
URL of a video clip to be displayed through the IMG element. Changing this property loads a new video clip into the image object. See also the loop property for controlling the frequency of video clip play. | |||
Exampledocument.images[3].dynsrc = "snowman.avi" | |||
Value Complete or relative URL as a string. | |||
|
height, width | NN 3 IE 4 DOM 1 | ||
Read/Write (IE) | |||
The height and width in pixels of the image element. Changes to these values are immediately reflected in reflowed content on the page in Internet Explorer 4. Be aware that images scale to fit the new dimension. | |||
Exampledocument.prettyPicture.height = 250 | |||
Value Integer. | |||
|
href | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
The URL specified by the element's SRC attribute. Identical to the src property. | |||
Exampledocument.logoImage.href = "images/fancyLogo.gif" | |||
Value String of complete or relative URL. | |||
|
hspace, vspace | NN 3 IE 4 DOM 1 | ||
Read/Write (IE) | |||
The pixel measure of horizontal and vertical margins surrounding an image object. The hspace property affects the left and right edges of the element equally; the vspace affects the top and bottom edges of the element equally. These margins are not the same as margins set by style sheets, but they have the same visual effect. New values may be assigned to these properties in Internet Explorer 4. | |||
Exampledocument.logo.hspace = 5 document.logo.vspace = 8 | |||
Value Integer of pixel count. | |||
|
isMap | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
Whether the IMG element is acting as a server-side image map. For an image to be a server-side image map, it must be wrapped with an A element whose HREF attribute points to the URL of the CGI program that knows how to interpret the click coordinate information. The browser appends coordinate information about the click to the URL as a GET form method appends form element data to the ACTION attribute URL. More recent browsers allow client-side image maps (see the useMap property), which operate more quickly for the user, because there is no communication with the server to carry out the examination of the click coordinate point. | |||
Exampledocument.navMap.isMap = true | |||
Value Boolean value: true | false. | |||
|
loop | NN n/a IE 4 DOM n/a | ||
Read/Write | |||
If you specify a video clip with the DYNSRC attribute, the loop property controls how many times the clip should play (loop). Changing to a value of -1 is equal to a continuous loop. | |||
Exampledocument.movieImg.loop = 3 | |||
Value Integer. | |||
|
lowsrc | NN 3 IE 4 DOM n/a | ||
Read/Write (IE) | |||
The URL of a lower-resolution (or alternate) image to download into the document space if the image of the SRC attribute will take a long time to download. The lowsrc image should be the same pixel size as the primary SRC image. It makes sense to change the lowsrc property only if you are also going to change the src property. In this case, make sure you change the lowsrc property first so that the browser knows how to handle the long download for the src image. | |||
Exampledocument.productImage.lowsrc = "images/widget43LoRes.jpg" | |||
Value Any complete or relative URL as a string. | |||
|
name | NN 2 IE 3 DOM 1 | ||
Read/Write | |||
The identifier associated with the image object for use in scripted references to the object. | |||
Examplevar imgName = document.images[3].name | |||
Value Case-sensitive identifier that follows the rules of identifier naming: it may contain no whitespace, cannot begin with a numeral, and should avoid punctuation except for the underscore character. | |||
|
protocol | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Normally, this property returns the protocol component of the URL associated with the element. Values for an IMG object do not follow the regular format (for local file access, for example, the returned value is File Protocol instead of file:). This property, which works only in Win32, does not appear to be wired properly. | |||
Value String. | |||
|
prototype | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Returns a reference to the static Image object
from which all instances of image objects are created. This mechanism
is more commonly used in JavaScript core language objects (see | |||
Value Object reference. | |||
|
readyState | NN n/a IE 4 DOM n/a | ||
Read-only | |||
Returns the current download status of the image content. This property provides a more granular way of testing whether a particular downloadable element is ready to be run or scripted instead of the onLoad event handler for the entire document. As the value of this property changes during loading, the system fires an onReadyStateChange event. | |||
Exampleif (document.contentsMap.readyState == "uninitialized") { } | |||
Value One of the following values (as strings): complete | interactive | loading | uninitialized. Some elements may allow the user to interact with partial content, in which case the property may return interactive until all loading has completed. | |||
|
useMap | NN n/a IE 4 DOM 1 | ||
Read/Write | |||
The URL of the MAP element in the same document that contains client-side image map hot areas and links. The value includes the hashmark assigned with the map name in the USEMAP attribute of the IMG element. | |||
Exampledocument.images[0].useMap = "#altMap" | |||
Value A string starting with a hashmark and the name of the MAP element. | |||
|
x, y | NN 4 IE n/a DOM n/a | ||
Read-only | |||
The horizontal and vertical pixel coordinates of the top-left corner of the image relative to the page. These are Navigator-only properties, corresponding to the offsetLeft and offsetTop properties of Internet Explorer 4. | |||
Examplevar imageFromTop = document.logoImg.y | |||
Value Integer. | |||
|
blur( ) | NN n/a IE 4 DOM n/a |
Removes focus from the current element and fires an onBlur event (in IE). No other element necessarily receives focus as a result. | |
Returned Value None. | |
Parameters None. |
focus( ) | NN n/a IE 4 DOM n/a |
Gives focus to the current element and fires the onFocus event (in IE). If another element had focus at the time, it receives an onBlur event. | |
Returned Value None. | |
Parameters None. |