因为我的图片某个区域的链接是要动态生成的如果用javascript赋予图片某个区域的链接

解决方案 »

  1.   

    给area标签加个id , 用getElementById获取其DOM对象 , 修改其href属性即可..
      

  2.   

    阅读HTML参考手册中usemap和area的用法。
      

  3.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>test</title>
    <script>
    function changeSrc(){
    document.getElementById("area1").href="http://www.baidu.com";
    }
    </script>
    </head><body>
    <map name="FPMap0">
    <area id=area1 href="http://www.csdn.net/" shape="rect" coords="11, 12, 56, 45">
    </map>
    <img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" usemap="#FPMap0"/>
    <input type="button" value="修改连接" onclick="changeSrc()">
    </body></html>
      

  4.   


    <img src="1.jpg" usemap="#map" />
    <map name="map">
      <area id="a" shape="rect" coords="112,66,189,99" href="#" />
    </map>function f(){
        document.getElementById("a").href = "your url";
    }
    其实热区还是用DM直接拖的好 我是懒人
      

  5.   

    谢谢lihui_shine再问一个问题,如何添加一个area呢
      

  6.   

    area是事先写好的吗,如何动态添加呢