USEMAP Attribute | useMap Property

DHTML, HTML, & CSS

USEMAP Attribute | useMap Property


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

Syntax

HTML<IMG USEMAP = sURL ... >
Scriptingimg.useMap [ = sURL ]

Possible Values

sURLString that specifies the URL of the image map.

The property is read/write with no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

The useMap property identifies the image as a client-side image map by associating a MAP object with the image. This MAP object contains AREA objects that define regions within the image. The user can click these regions to navigate to a designated URL.

You can dynamically assign the maps to the image through the useMap property.

Example

This example specifies map1 as the image map underlying image.gif. The map can be changed to another map, map2, by clicking the button.

Sample Code

<MAP NAME="map1">
<AREA NAME="area1" COORDS="0,0,40,40" HREF="doc1.htm" 
    TARGET="frame1">
<AREA NAME="area2" COORDS="40,0,80,40" HREF="doc2.htm" 
    TARGET="frame1">
<AREA NAME="area3" COORDS="10,40,40,80" HREF="doc3.htm" 
    TARGET="frame1">
<AREA NAME="area4" COORDS="40,40,80,80" HREF="doc4.htm" 
    TARGET="frame1">
</MAP>
:
<IMG USEMAP="#map1" ID=idImg SRC="image.gif">
:
<BUTTON onclick="idImg.useMap='#map2'">
    Change Maps</BUTTON>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.

IMG


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.