zl程序教程

您现在的位置是:首页 >  前端

当前栏目

把图像热区跟链接关联起来

链接 关联 图像 起来
2023-06-13 09:11:17 时间

把图像热区跟链接关联起来

Ghostzhang 发表于 2007-07-20 18:46

在《Sample XHTML 1.0 document》里看到图像热区也可以跟链接关联到一起,即点热区和点链接是一样的地址。看下具体的玩法。

正常的玩法:

  • Result
  • HTML
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRQvhdnv0jPrvemdtnBh58ryzRJ2CcUUkM1o5hU1jHSHo-56OmY" alt="image" usemap="#map" height="100" width="100">
<div>
    <map xml:lang="en" dir="ltr" id="map" class="map" title="map" name="map" lang="en">
        <area href="#1" shape="rect" coords="0,0,50,50" alt="map1" title="map1">
        <area href="#2" shape="rect" coords="50,0,100,50" alt="map2" title="map2">
        <area href="#3" shape="rect" coords="0,50,50,100" alt="map3" title="map3">
        <area shape="rect" coords="50,50,100,100" href="#4" alt="map4" title="map4">
    </map>
</div>

关联链接:

  • HTML
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRQvhdnv0jPrvemdtnBh58ryzRJ2CcUUkM1o5hU1jHSHo-56OmY" alt="image" usemap="#map2" height="100" width="100">
<div>
    <map xml:lang="en" dir="ltr" id="map2" class="map" title="map" name="map2" lang="en">
        <ul>
            <li><a href="#" shape="rect" coords="0,0,50,50">map1</a>
            </li>
            <li><a href="#" shape="rect" coords="50,0,100,50">map2</a>
            </li>
            <li><a href="#" shape="rect" coords="0,50,50,100">map3</a>
            </li><li><a href="#" shape="rect" coords="50,50,100,100">map4</a>
            </li>
        </ul>
    </map>
</div>