I wrote a simple web page in HTML:
我用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>
Which returns a map of the world, and should create a link for every continent.
它返回一个世界地图,并应为每个大陆创建一个链接。
However, the links do not respond to clicking.
但是,链接不响应点击。
What might be the problem?
可能是什么问题?
2 个解决方案
#1
5
Your usemap="#WorldMap"
must match the name
tag. Not the id.
您的usemap =“#WorldMap”必须与名称标签匹配。不是身份证。
Like this:
<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>
#2
3
If you're linking to an off-site resource your links must contain an http://
or https://
prefix.
如果要链接到场外资源,则链接必须包含http://或https://前缀。
That means you need:
这意味着你需要:
<area alt="NorthAmerica" title="" href="http://www.google.com" shape="rect" coords="307,181,488,250" />
Though presumably you'd make that a more specific link.
虽然大概你可以把它作为一个更具体的链接。
#1
5
Your usemap="#WorldMap"
must match the name
tag. Not the id.
您的usemap =“#WorldMap”必须与名称标签匹配。不是身份证。
Like this:
<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>
#2
3
If you're linking to an off-site resource your links must contain an http://
or https://
prefix.
如果要链接到场外资源,则链接必须包含http://或https://前缀。
That means you need:
这意味着你需要:
<area alt="NorthAmerica" title="" href="http://www.google.com" shape="rect" coords="307,181,488,250" />
Though presumably you'd make that a more specific link.
虽然大概你可以把它作为一个更具体的链接。