Examples of using usermap in img

Time:2020-11-26

Usemap is an attribute of the < img > tag and is used to indicate the image map name used.

The map of ා map is an image map defined with the < Map > tag. Its name attribute is map, which is defined as follows:

Copy code

The code is as follows:

<map name=”Map”>
<area shape=rect coods=”100,100,200,200″ href=”test1.html”>
<area shape=rect coods=”200,100,300,200″ href=”test2.html”>

</map>

When using:

Copy code

The code is as follows:

<img src=”test.gif” usemap=”#Map”>

Image map divides an image into several areas. Click on different areas to enter different pages.

In order to create a client image, you need to add a new attribute usemap as follows:

Copy code

The code is as follows:

<IMG SRC=”map_name.gif” USEMAP=”#section_name”>

The attribute usemap (using images) accepts segmented hyperlinks, so image definition information can be stored in the same HTML file.

Copy code

The code is as follows:

<IMG src=”Images/index-top.jpg” border=”0″ usemap=”#Map” onclick=”return IMG1_onclick()”>
<MAP name=”Map”>
<AREA shape=”rect” coords=”224,95,307,125″ href=”default.aspx”>
<AREA shape=”rect” coords=”326,96,407,123″ href=”Cart.aspx”>
<AREA shape=”rect” coords=”426,96,503,125″ href=”MemberShip/UserLogin.aspx”>
<AREA shape=”rect” coords=”525,96,609,125″ href=”Admin/default.aspx”>
</MAP>