我用HTML写了一个简单的网页:
<!DOCTYPE html>
<html>
<body>
<img src="http://media.web.britannica.com/eb-media/59/89959-050-6CC4DDA1.jpg" alt="WorldMap" usemap="#Map" />
<map name="WorldMap" id="Map">
<area alt="NorthAmerica" title="" href="www.google.com" shape="rect" coords="307,181,488,250" />
<area alt="SouthAmerica" title="" href="www.google.com" shape="rect" coords="468,504,636,432" />
<area alt="Europe" title="" href="www.google.com" shape="rect" coords="853,147,1005,180" />
<area alt="Africa" title="" href="www.google.com" shape="rect" coords="964,350,826,383" />
<area alt="Asia" title="" href="www.google.com" shape="rect" coords="1115,232,1221,193" />
<area alt="Australia" title="" href="www.google.com" shape="rect" coords="1270,564,1483,532" />
[...]
</map>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它返回一个世界地图,并应为每个大陆创建一个链接.
但是,链接不响应点击.
可能是什么问题?
您usemap="#WorldMap"必须与name标签匹配.不是身份证.
像这样:
<img src="http://media.web.britannica.com/eb-media/59/89959-050-6CC4DDA1.jpg" alt="WorldMap" usemap="#WorldMap" />
<map name="WorldMap" id="Map">
<area alt="NorthAmerica" title="" href="/#" shape="rect" coords="307,181,488,250" />
<area alt="SouthAmerica" title="" href="/#" shape="rect" coords="468,504,636,432" />
<area alt="Europe" title="" href="/#" shape="rect" coords="853,147,1005,180" />
<area alt="Africa" title="" href="/#" shape="rect" coords="964,350,826,383" />
<area alt="Asia" title="" href="/#" shape="rect" coords="1115,232,1221,193" />
<area alt="Australia" title="" href="/#" shape="rect" coords="1270,564,1483,532" />
</map>Run Code Online (Sandbox Code Playgroud)