IHTMLImgElement

IHTMLImgElement


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
put_isMap   get_isMap   put_useMap  
get_useMap   get_mimeType   get_fileSize  
get_fileCreatedDate   get_fileModifiedDate   get_fileUpdatedDate  
get_protocol   get_href   get_nameProp  
put_border   get_border   put_vspace  
get_vspace   put_hspace   get_hspace  
put_alt   get_alt   put_src  
get_src   put_lowsrc   get_lowsrc  
put_vrml   get_vrml   get_dynsrc  
get_readyState   get_complete   put_loop  
get_loop   put_align   get_align  
put_onload   get_onload   put_onerror  
get_onerror   put_onabort   get_onabort  
put_name   get_name   put_width  
get_width   put_height   get_height  
put_start   get_start  

IHTMLImgElement::put_isMap

HRESULT put_isMap(
    VARIANT_BOOL v
);

Specifies whether the picture is a server-side image map.

v
Boolean value that, if TRUE, specifies that the picture is a server-side image map.

See also get_isMap

IHTMLImgElement::get_isMap

HRESULT get_isMap(
    VARIANT_BOOL *p
);

Determines whether the picture is a server-side image map.

p
Address of a variable that receives TRUE if the picture is a server-side image map, or FALSE if not.

See also put_isMap

IHTMLImgElement::put_useMap

HRESULT put_useMap(
    BSTR v
);

Identifies a URL, often with a bookmark extension (#name), to use as a client-side image map.

v
String specifying the URL.

See also get_useMap

IHTMLImgElement::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.

p
Address of a variable that receives the URL.

See also put_useMap

IHTMLImgElement::get_mimeType

HRESULT get_mimeType(
    BSTR *p
);

Retrieves the MIME type for the file.

p
Address of a variable that receives the MIME type. This parameter receives "text/html" for HTML files.

IHTMLImgElement::get_fileSize

HRESULT get_fileSize(
    BSTR *p
);

Retrieves the size, in bytes, of the image file associated with the element.

p
Address of a variable that receives the file size.

IHTMLImgElement::get_fileCreatedDate

HRESULT get_fileCreatedDate(
    BSTR *p
);

Retrieves the creation date of the image file associated with the element.

p
Address of a variable that receives the creation date. The date consists of the weekday, month, date, and year.

IHTMLImgElement::get_fileModifiedDate

HRESULT get_fileModifiedDate(
    BSTR *p
);

Retrieves the date when the image file associated with the element was most recently modified.

p
Address of a variable that receives the modification date. The date consists of the weekday, month, date, and year.

IHTMLImgElement::get_fileUpdatedDate

HRESULT get_fileUpdatedDate(
    BSTR *p
);

Retrieves the date when the image file associated with the element was last updated.

p
Address of a variable that receives the date. The date consists of the weekday, month, date, and year.

IHTMLImgElement::get_protocol

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.

p
Address of a variable that receives the protocol.

IHTMLImgElement::get_href

HRESULT get_href(
    BSTR *p
);

Retrieves the entire URL that the browser uses to locate the image or video clip associated with the element.

p
Address of a variable that receives the URL.

IHTMLImgElement::get_nameProp

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.

p
Address of a variable that receives the file name.

IHTMLImgElement::put_border

HRESULT put_border(
    VARIANT v
);

Sets the thickness of the border around the element.

v
A string or value specifying the border thickness.

See also get_border

IHTMLImgElement::get_border

HRESULT get_border(
    VARIANT *p
);

Retrieves the current thickness of the border around the element.

p
Address of a variable that receives the border thickness.

See also put_border

IHTMLImgElement::put_vspace

HRESULT put_vspace(
    long v
);

Sets the vertical margins for the element.

v
Value specifying the margins.

Similar to border, except the margins are not painted with color when the element is a link.

See also get_vspace

IHTMLImgElement::get_vspace

HRESULT get_vspace(
    long *p
);

Retrieves the vertical margins for the element.

p
Address of a variable that receives the vertical margins.

Similar to border, except the margins are not painted with color when the element is a link.

See also put_vspace

IHTMLImgElement::put_hspace

HRESULT put_hspace(
    long v
);

Sets the horizontal margins for the element.

v
Value specifying the horizontal margins.

Similar to border, except the margins are not painted with color when the element is a link.

See also get_hspace

IHTMLImgElement::get_hspace

HRESULT get_hspace(
    long *p
);

Retrieves the horizontal margins for the element.

p
Address of a variable that receives the horizontal margins.

Similar to border, except the margins are not painted with color when the element is a link.

See also put_hspace

IHTMLImgElement::put_alt

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.

v
String specifying the optional text.

See also get_alt

IHTMLImgElement::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.

p
Address of a variable that receives the optional text.

See also put_alt

IHTMLImgElement::put_src

HRESULT put_src(
    BSTR v
);

Sets the URL of an image to be shown.

v
String specifying the URL.

See also get_src

IHTMLImgElement::get_src

HRESULT get_src(
    BSTR *p
);

Retrieves the URL of a sound to be played.

p
Address of a variable that receives the URL.

See also put_src

IHTMLImgElement::put_lowsrc

HRESULT put_lowsrc(
    BSTR v
);

Specifies the URL of a lower-resolution image to display.

v
String specifying the URL.

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

IHTMLImgElement::get_lowsrc

HRESULT get_lowsrc(
    BSTR *p
);

Retrieves the URL of a lower-resolution image to display.

p
Address of a variable that receives the URL.

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

IHTMLImgElement::put_vrml

HRESULT put_vrml(
    BSTR v
);

Specifies the URL of a VRML world to be displayed in the window.

v
String specifying the URL.

See also get_vrml

IHTMLImgElement::get_vrml

HRESULT get_vrml(
    BSTR *p
);

Retrieves the URL of the VRML world to be displayed in the window.

p
Address of a variable that receives the URL.

See also put_vrml

IHTMLImgElement::put_dynsrc

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.

v
String specifying the address.

See also get_dynsrc

IHTMLImgElement::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.

p
Address of a variable that receives the address.

See also put_dynsrc

IHTMLImgElement::get_readyState

HRESULT get_readyState(
    BSTR *p
);

Retrieves the current state of an object being downloaded.

p
Address of a variable that receives the state. Can be one of these values:
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.

IHTMLImgElement::get_complete

HRESULT get_complete(
    VARIANT_BOOL *p
);

Retrieves whether the specified element is fully loaded.

p
Address of a variable that receives TRUE if the element is fully loaded, or FALSE otherwise.

IHTMLImgElement::put_loop

HRESULT put_loop(
    VARIANT v
);

Sets the number of times a video will loop when activated.

v
Value specifying the number of times to loop. If this parameter is -1 (infinite), the video will loop continuously.

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

IHTMLImgElement::get_loop

HRESULT get_loop(
    VARIANT *p
);

Retrieves the number of times a video loops when activated.

p
Value specifying the number of times to loop. If this parameter receives -1 (infinite), the video will loop continuously.

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

IHTMLImgElement::put_align

HRESULT put_align(
    BSTR v
);

Sets how the element is aligned with adjacent text.

v
String specifying the alignment. Can be one of these values:
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

IHTMLImgElement::get_align

HRESULT get_align(
    BSTR *p
);

Retrieves how the element is aligned with adjacent text.

p
Address of a variable that receives the alignment. Can be one of these values:
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

IHTMLImgElement::put_onload

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.

v
VARIANT structure that contains the new script.

See also get_onload

IHTMLImgElement::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.

p
Address of a VARIANT structure that receives the script.

See also put_onload

IHTMLImgElement::put_onerror

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.

v
VARIANT structure that contains the new script.

See also get_onerror

IHTMLImgElement::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.

p
Address of a VARIANT structure that receives the script.

See also put_onerror

IHTMLImgElement::put_onabort

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.

v
VARIANT structure that contains the new script.

See also get_onabort

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.