代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
<head>
<!-- 设置页面标题 -->
<title>点击图片的左边是百度,右边是微博</title>
</head>

<body>
<!-- 插入图片,并应用图像映射 -->
<img src="./icon-hexo.png" usemap="#top_bg"/>

<!-- 定义图像映射 -->
<map name="top_bg">
<!-- 定义百度链接的矩形区域 -->
<area alt="百度" href="http://www.baidu.com" shape="rect" target="blank" coords="0,0,300,300"/>

<!-- 定义微博链接的矩形区域 -->
<area alt="微博" href="http://weibo.com" shape="rect" target="blank" coords="400,0,700,400"/>
</map>
</body>
</html>

效果

点击图片左右侧将分别跳转不同链接。

百度 微博