
This interface provides access to some of the properties and methods supported by the IMG element and the INPUT element of the image type. The other properties and methods are accessible through the IHTMLImgElement interface.
The IMG element embeds an image or a video clip in a document. It supports the onfocus event and can receive the input focus only if it has been associated with a MAP element.
IHTMLImgElement Methods
HRESULT put_isMap(
VARIANT_BOOL v
);
Specifies whether the picture is a server-side image map.
See also get_isMap
HRESULT get_isMap(
VARIANT_BOOL *p
);
Determines whether the picture is a server-side image map.
See also put_isMap
HRESULT put_useMap(
BSTR v
);
Identifies a URL, often with a bookmark extension (#name), to use as a client-side image map.
See also get_useMap
HRESULT get_useMap(
BSTR *p
);
Retrieves the URL used as a client-side image map. The URL includes the bookmark extension (#name), if any.
See also put_useMap
HRESULT get_mimeType(
BSTR *p
);
Retrieves the MIME type for the file.
HRESULT get_fileSize(
BSTR *p
);
Retrieves the size, in bytes, of the image file associated with the element.
HRESULT get_fileCreatedDate(
BSTR *p
);
Retrieves the creation date of the image file associated with the element.
HRESULT get_fileModifiedDate(
BSTR *p
);
Retrieves the date when the image file associated with the element was most recently modified.
HRESULT get_fileUpdatedDate(
BSTR *p
);
Retrieves the date when the image file associated with the element was last updated.
HRESULT get_protocol(
BSTR *p
);
Retrieves the protocol portion of the URL that the browser uses to locate the image or video clip associated with the element. The protocol portion, which indicates the access method, includes the initial substring of the URL up to and including the first colon.
HRESULT get_href(
BSTR *p
);
Retrieves the entire URL that the browser uses to locate the image or video clip associated with the element.
HRESULT get_nameProp(
BSTR *p
);
Retrieves the file name from the URL that the browser uses to locate the image or video clip associated with the element.
HRESULT put_border(
VARIANT v
);
Sets the thickness of the border around the element.
See also get_border
HRESULT get_border(
VARIANT *p
);
Retrieves the current thickness of the border around the element.
See also put_border
HRESULT put_vspace(
long v
);
Sets the vertical margins for the element.
Similar to border, except the margins are not painted with color when the element is a link.
See also get_vspace
HRESULT get_vspace(
long *p
);
Retrieves the vertical margins for the element.
Similar to border, except the margins are not painted with color when the element is a link.
See also put_vspace
HRESULT put_hspace(
long v
);
Sets the horizontal margins for the element.
Similar to border, except the margins are not painted with color when the element is a link.
See also get_hspace
HRESULT get_hspace(
long *p
);
Retrieves the horizontal margins for the element.
Similar to border, except the margins are not painted with color when the element is a link.
See also put_hspace
HRESULT put_alt(
BSTR v
);
Indicates optional text as an alternative to the graphic for rendering in nongraphical environments. Alternate text should be provided whenever the graphic is not rendered. Alternate text is mandatory for Level 0 documents.
See also get_alt
HRESULT get_alt(
BSTR *p
);
Retrieves the optional text as an alternative to the graphic for rendering in nongraphical environments. Alternate text should be provided whenever the graphic is not rendered. Alternate text is mandatory for Level 0 documents.
See also put_alt
HRESULT put_src(
BSTR v
);
Sets the URL of an image to be shown.
See also get_src
HRESULT get_src(
BSTR *p
);
Retrieves the URL of a sound to be played.
See also put_src
HRESULT put_lowsrc(
BSTR v
);
Specifies the URL of a lower-resolution image to display.
Setting the SRC= attribute in code has the side-effect of actually starting to load the new URL into the image area (and aborting the transfer of any image data that is already loading into the same area). Therefore, you should alter the lowsrc property before setting the src property. If the URL in the src property refers to an image that is not the same size as the image cell it is loaded into, the source image is scaled to fit.
See also get_lowsrc
HRESULT get_lowsrc(
BSTR *p
);
Retrieves the URL of a lower-resolution image to display.
Setting the SRC= attribute in code has the side-effect of actually starting to load the new URL into the image area (and aborting the transfer of any image data that is already loading into the same area). Therefore, you should alter the lowsrc property before setting the src property. If the URL in the src property refers to an image that is not the same size as the image cell it is loaded into, the source image is scaled to fit.
See also put_lowsrc
HRESULT put_vrml(
BSTR v
);
Specifies the URL of a VRML world to be displayed in the window.
See also get_vrml
HRESULT get_vrml(
BSTR *p
);
Retrieves the URL of the VRML world to be displayed in the window.
See also put_vrml
HRESULT put_dynsrc(
BSTR v
);
Sets the address of a video clip or VRML world to be displayed in the window. Stands for Dynamic Source.
See also get_dynsrc
HRESULT get_dynsrc(
BSTR *p
);
Retrieves the address of a video clip or VRML world to be displayed in the window. Stands for Dynamic Source.
See also put_dynsrc
HRESULT get_readyState(
BSTR *p
);
Retrieves the current state of an object being downloaded.
| complete | The object is completely loaded. |
| interactive | The object can be interacted with even though it is not fully loaded. |
| loading | The object is currently being loaded. |
| unitialized | The object is not created. Usually when the object is being downloaded. |
Each object can independently determine which of the states they expose.
HRESULT get_complete(
VARIANT_BOOL *p
);
Retrieves whether the specified element is fully loaded.
HRESULT put_loop(
VARIANT v
);
Sets the number of times a video will loop when activated.
Below are descriptions on how loop works for some boundary cases.
| <BGSOUND src="file:///c:\win95\system\msremind.wav"> | once |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP> | once |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=> | zero times |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=-1> | infinitely |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=0> | once |
See also get_loop
HRESULT get_loop(
VARIANT *p
);
Retrieves the number of times a video loops when activated.
Below are descriptions on how loop works for some boundary cases.
| <BGSOUND src="file:///c:\win95\system\msremind.wav"> | once |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP> | once |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=> | zero times |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=-1> | infinitely |
| <BGSOUND src="file:///c:\win95\system\msremind.wav" LOOP=0> | once |
See also put_loop
HRESULT put_align(
BSTR v
);
Sets how the element is aligned with adjacent text.
| absbottom | Aligns the bottom of the element with the absolute bottom of the surrounding text. The absolute bottom is equal to the baseline of the text minus the height of the largest descender in the text. |
| absmiddle | Aligns the middle of the element with the middle of the surrounding text. The absolute middle is the midpoint between the absolute bottom and texttop of the surrounding text. |
| baseline | Aligns the bottom of the element with the baseline of the surrounding text. |
| bottom | Aligns the bottom of the element with the bottom of the surrounding text. The bottom is equal to the baseline minus the standard height of a descender in the text. |
| left | Aligns the element to the left of the surrounding text. All preceding and subsequent text flows to the right of the element. This is the default value. |
| middle | Aligns the middle of the element with the surrounding text. |
| right | Aligns the element to the right of the surrounding text. All subsequent text flows to the left of the element. |
| texttop | Aligns the top of the element with the absolute top of the surrounding text. The absolute top is the baseline plus the height of the largest ascender in the text. |
| top | Aligns the top of the element with the top of the text. The top of the text is the baseline plus the standard height of an ascender in the text. |
For the INPUT element, this attribute applies only to the image type. It is undefined for all other types.
See also get_align
HRESULT get_align(
BSTR *p
);
Retrieves how the element is aligned with adjacent text.
| absbottom | Aligns the bottom of the element with the absolute bottom of the surrounding text. The absolute bottom is equal to the baseline of the text minus the height of the largest descender in the text. |
| absmiddle | Aligns the middle of the element with the middle of the surrounding text. The absolute middle is the midpoint between the absolute bottom and texttop of the surrounding text. |
| baseline | Aligns the bottom of the element with the baseline of the surrounding text. |
| bottom | Aligns the bottom of the element with the bottom of the surrounding text. The bottom is equal to the baseline minus the standard height of a descender in the text. |
| left | Aligns the element to the left of the surrounding text. All preceding and subsequent text flows to the right of the element. This is the default value. |
| middle | Aligns the middle of the element with the surrounding text. |
| right | Aligns the element to the right of the surrounding text. All subsequent text flows to the left of the element. |
| texttop | Aligns the top of the element with the absolute top of the surrounding text. The absolute top is the baseline plus the height of the largest ascender in the text. |
| top | Aligns the top of the element with the top of the text. The top of the text is the baseline plus the standard height of an ascender in the text. |
For the INPUT element, this attribute applies only to the image type. It is undefined for all other types.
See also put_align
HRESULT put_onload(
VARIANT v
);
Sets the inline script associated with the onload event for an IMG element. The onload event occurs immediately after the browser loads the given object.
See also get_onload
HRESULT get_onload(
VARIANT *p
);
Retrieves the inline script associated with the onload event for an IMG element. The onload event occurs immediately after the browser loads the given object.
See also put_onload
HRESULT put_onerror(
VARIANT v
);
Sets the inline script associated with the onerror event for an IMG element. The onerror event occurs when the loading of a document or image causes an error.
See also get_onerror
HRESULT get_onerror(
VARIANT *p
);
Retrieves the inline script associated with the onerror event for an IMG element. The onerror event occurs when the loading of a document or image causes an error.
See also put_onerror
HRESULT put_onabort(
VARIANT v
);
Sets the inline script associated with the onabort event for an IMG element. The onabort event occurs when the user aborts the download of the image.
See also get_onabort
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.