2017-07-17 3 views
1

Ich schrieb eine einfache Web-Seite in HTML:Die href-Links in meinem HTML-Code werden nicht funktionieren.

<!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> 

, die eine Karte der Welt gibt, und sollten Sie einen Link für jeden Kontinent schaffen.

Die Links reagieren jedoch nicht auf Klicken.

Was könnte das Problem sein?

Antwort

3

Wenn Sie Muss zu einer Off-Site-Ressource Ihrer Links sind Verknüpfung enthält einen http:// oder https:// Präfix.

Das heißt, Sie brauchen:

<area alt="NorthAmerica" title="" href="http://www.google.com" shape="rect" coords="307,181,488,250" /> 

Obwohl vermutlich, dass eine spezifischere Link machen würde.

+0

, dass bei der Hand Gedanken nicht das Problem ist ... wäre es immer noch anklickbar sein und ein Hand-Cursor unabhängig erscheinen würden. – Miro

5

Ihr usemap="#WorldMap" muss mit dem Tag name übereinstimmen. Nicht die ID.

So:

<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>

Verwandte Themen