mozilla firefox中的usemap属性

时间:2013-01-14 14:13:11

标签: html google-chrome firefox imagemap

我有这个片段:

<body> <map name="planetmap"> <area shape="poly" coords="39,195,70,180,33,117,7,77" href="result.php?usa=california" alt="ca"> <area shape="poly" coords="64,199,81,153,122,160,113,221" href="result.php?usa=arizona" alt="az"> <area shape="poly" coords="113,221,169,219,175,165,121,159" href="result.php?usa=new mexico" alt="nm"> <area shape="poly" coords="70,175,89,98,42,88,35,119" href="result.php?usa=nevada" alt="nv"> <area shape="poly" coords="80,152,123,159,130,116,89,98" href="result.php?usa=utah" alt="ut"> <area shape="poly" coords="122,159,184,164,186,120,128,114" href="result.php?usa=colorado" alt="co"> <area shape="poly" coords="31,6,81,17,76,49,23,32" href="result.php?usa=washington" alt="wa"> <area shape="poly" coords="76,49,23,32,65,91,7,77" href="result.php?usa=oregon" alt="or"> <area shape="poly" coords="66,92,83,17,118,74,113,101" href="result.php?usa=idaho" alt="id"> <area shape="poly" coords="104,72,90,18,174,75,177,31" href="result.php?usa=montana" alt="mt"> <area shape="poly" coords="119,69,112,113,170,118,173,75" href="result.php?usa=wyoming" alt="wy"> <area shape="poly" coords="178,30,228,34,233,60,175,65" href="result.php?usa=north dakota" alt="nd"> <area shape="poly" coords="175,65,233,60,231,103,172,98" href="result.php?usa=south dakota" alt="sd"> <area shape="poly" coords="231,103,172,98,185,131,141,134" href="result.php?usa=nebraska" alt="ne"> <area shape="poly" coords="185,131,141,134,184,164,249,167" href="result.php?usa=kansas" alt="ks"> <area shape="poly" coords="201,165,249,167,207,197,250,204" href="result.php?usa=oklahoma" alt="ok"> <area shape="poly" coords="176,170,259,233,152,245,223,287" href="result.php?usa=texas" alt="tx"> <area shape="poly" coords="230,36,233,95,275,94,268,41" href="result.php?usa=minnesota" alt="mn"> <area shape="poly" coords="234,94,275,94,239,127,278,127" href="result.php?usa=iowa" alt="ia"> <area shape="poly" coords="239,127,278,127,295,170,250,173" href="result.php?usa=missouri" alt="mo"> <area shape="poly" coords="250,173,251,204,292,177,282,209" href="result.php?usa=arkansas" alt="ar"> <area shape="poly" coords="255,209,281,210,261,246,298,240" href="result.php?usa=louisiana" alt="la"> <area shape="poly" coords="269,54,301,72,280,104,302,103" href="result.php?usa=wisconsin" alt="wi"> <area shape="poly" coords="324,63,346,92,342,107,313,109" href="result.php?usa=michigan" alt="mi"> <area shape="poly" coords="280,104,302,103,282,143,307,152" href="result.php?usa=illinois" alt="il"> <area shape="poly" coords="313,109,307,153,329,109,332,139" href="result.php?usa=indiana" alt="in"> <area shape="poly" coords="329,109,332,139,358,134,362,101" href="result.php?usa=ohio" alt="oh"> <area shape="poly" coords="332,137,358,153,348,164,302,163" href="result.php?usa=kentucky" alt="ky"> <area shape="poly" coords="295,171,364,164,343,182,288,188" href="result.php?usa=tennessee" alt="tn"> <area shape="poly" coords="288,188,308,186,279,234,308,286" href="result.php?usa=mississippi" alt="ms"> <area shape="poly" coords="309,185,310,235,330,134,340,230" href="result.php?usa=alabama" alt="al"> <area shape="poly" coords="329,184,352,183,343,230,380,225" href="result.php?usa=georgia" alt="ga"> <area shape="poly" coords="319,131,374,227,403,279,387,286" href="result.php?usa=florida" alt="fl"> <area shape="poly" coords="365,126,358,127,372,151,353,144" href="result.php?usa=west virginia" alt="wv"> <area shape="poly" coords="376,210,395,188,354,184,370,176" href="result.php?usa=south carolina" alt="sc"> <area shape="poly" coords="405,179,345,179,411,159,364,162" href="result.php?usa=north carolina" alt="nc"> <area shape="poly" coords="389,125,413,159,372,150,361,163" href="result.php?usa=virginia" alt="va"> <area shape="poly" coords="367,124,366,100,406,94,410,116" href="result.php?usa=pennsylvania" alt="pa"> <area shape="poly" coords="438,73,430,38,459,44,440,17" href="result.php?usa=maine" alt="me"> <area shape="poly" coords="414,56,419,100,405,92,373,90" href="result.php?usa=new york" alt="ny"> <area shape="poly" coords="426,56,415,55,425,79,418,78" href="result.php?usa=vermont" alt="vt"> <area shape="poly" coords="429,49,439,73,425,78,428,59" href="result.php?usa=new hampshire" alt="nh"> <area shape="poly" coords="422,97,419,90,433,86,436,92" href="result.php?usa=connecticut" alt="ct"> <area shape="poly" coords="418,81,420,89,438,77,441,85" href="result.php?usa=massachusetts" alt="ma"> <area shape="poly" coords="431,96,412,100,410,117,416,125" href="result.php?usa=new jersey" alt="nj"> <area shape="poly" coords="406,118,390,124,416,131,412,164" href="result.php?usa=maryland" alt="md"> </map> <form name="search" method="post" style="position:relative;left:300px;height:800px; width: 600px;" > <div name="map" style="width:1200px; height: 150px;"> <a name="map"><img src="../images/usa.gif"/ usemap="planetmap"></a> </div>

当我使用浏览器google chrome时,此代码有效但是当我使用mozilla firefox时,图像的各个部分变得不可用了我不知道代码html是否依赖于浏览器的类型和版本,因为它是一个简单的html代码,用于划分图像的各个部分,并根据单击的部分重定向到其他页面。所以:

  • 这个错误的原因是什么?
  • 我该如何解决?

1 个答案:

答案 0 :(得分:2)

您的usemap属性后面有一个斜杠。解决了这个问题。

更改

<img src="../images/usa.gif"/ usemap="planetmap">

<img src="../images/usa.gif" usemap="#planetmap" />

编辑:同时尝试将id属性添加到地图中。

<map name="planetmap" id="planetmap">