IMG XHTML Element

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The IMG element embeds an image in the document. This is also the DOM object IMAGE.

Using this Element

There are some common properties and collections that apply to all the elements of the document object model, see Common Properties, Methods and Collections for the HTML Elements in Internet Explorer Mobile.

This element can be used within a web page with attributes.

This element can be used within scripts where it will have properties, events and methods.

Attributes

The following table shows items that Internet Explorer Mobile supports.

Attribute Value Description

ALIGN

 

Specifies the alignment of text following the IMG reference relative to the graphic on screen.

> [!NOTE] > Supported only for devices running Pocket PC 2002 and Smartphone 2002 software or later.

 

absbottom

This attribute is equivalent to the CSS:

vertical-align: text-bottom;

 

absmiddle

This attribute is equivalent to the CSS:

vertical-align: middle;

 

baseline

This attribute is equivalent to the CSS:

vertical-align: baseline;

 

bottom

This attribute is equivalent to the CSS:

vertical-align: bottom;

 

left

This attribute is equivalent to the CSS:

vertical-align: left;

 

middle

This attribute is equivalent to the CSS:

vertical-align: middle;

 

right

This attribute is equivalent to the CSS:

vertical-align: right;

 

texttop

This attribute is equivalent to the CSS:

vertical-align: text-top;

 

top

This attribute is equivalent to the CSS:

vertical-align: top;

ALT

String

Specifies a text alternative to the graphic

BORDER

0…#

This controls the thickness of the border around the image (in pixels) whether as a hyperlink or as a stand-alone image.

This attribute is equivalent to the CSS:

border: {n} solid;
> [!NOTE] > Supported only for devices running Pocket PC 2002 and Smartphone 2002 software or later.

CLASS

 

Associates the element with a CSS style.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

HEIGHT

0…#

Specifies the height of the image in pixels or as a percentage of the parent object.

This attribute is equivalent to the CSS:

height: {n};

HSPACE

0…#

Sets the horizontal margin for the image in pixels.

This attribute is equivalent to the CSS:

margin-left: {n}; margin-right: {n};

ID

 

Uniquely identifies the element within a document.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

ISMAP

 

Specifies that the image is a server side image map

NAME

 

 

ONLOAD

 

 

SRC

URL

Specifies the URL of the image to be displayed. The browser supports .JPEG, .JPG, .GIF, .PNG, .XBM, and .2BP files.

STYLE

 

Provides the definition of the CSS styles used for this element.

> [!NOTE] > Supported only for devices running Windows Mobile 2003 software or later.

USEMAP

URL

Specifies the URL of the client-side image map. For example, a bookmark like #map.

VSPACE

0…#

Sets the vertical margin for the image in pixels.

This attribute is equivalent to the CSS:

margin-top: {n}; margin-bottom: {n};

WIDTH

0…#

Specifies the width of the image in pixels or as a percentage of the parent object.

This attribute is equivalent to the CSS:

width: {n};

Scripting Properties

The following table shows items that Internet Explorer Mobile supports.

Property Type Access Comments

alt

string

Read

Sets or retrieves a text alternative to the graphic.

border

variant

Read

Sets or retrieves the width of the border to draw around the object.

height

long

Read/Write

Sets or retrieves the height of the object.

hspace

long

Read

Sets or retrieves the horizontal margin for the object.

onload

function

Read/Write

 

src

string

Read/Write

Sets or retrieves a URL to be loaded by the object.

vspace

long

Read

Sets or retrieves the vertical margin for the object.

width

long

Read/Write

Sets or retrieves the calculated width of the object.

Scripting Events

The following table shows items that Internet Explorer Mobile supports.

Event Comment

onload

 

Scripting Methods

This property has no associated methods.

Requirements

Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also

Concepts

Internet Explorer Mobile HTML Elements