本帖最后由 j2u1314 于 2010-04-09 14:09:35 编辑

解决方案 »

  1.   

    写A点的 mouseout
    热点的 mouseover
    组合实现你的需求
      

  2.   

    http://www.w3school.com.cn/tiy/t.asp?f=html_areamap参考这个例子吧
      

  3.   

      onmouseover移入 和onmouseout移出
      

  4.   

    <img src="Water lilies.jpg" usemap="#map_sample" border="0" alt="sample">
    <map name="map_sample">
    <area shape="circle" coords="156,164,5" href="#" alt="円">
    <area shape="circle" coords="200,85,5" href="#" alt="円">
    <area shape="poly" coords="156,109 173,154 211,146 217,120 181,99"   href="#" alt="多角形">
    </map>
    <script>
    var x1=156,y1=164;//A
    var x2=200,y2=85;//B
    var b=[[156,109],[173,154],[211,146],[217,120],[181,99]];
    var mx=0,my=0;//move point step
    function move(){
        if(x1+mx>x2)clearInterval(timer);
        mx++;//偏移量x
        my=(y2-y1)*mx/(x2-x1);//偏移量y
        // 起点y   +  相対偏移量x   * 斜率                              <=移動点y 
        if(b[1][1] + (mx+x1-b[1][0])*(b[0][1]-b[1][1])/(b[0][0]-b[1][0])<=my+y1){//正負号有問題,自己調試
            alert((mx+x1)+":"+(my+y1));
            clearInterval(timer);
        }
        
    }
    var timer=setInterval(move,10);
    </script>
      

  5.   

    再試試:
    <img src="Water lilies.jpg" usemap="#map_sample" border="0" alt="sample">
    <map name="map_sample">
    <area shape="circle" coords="156,164,5" href="#" alt="円">
    <area shape="circle" coords="200,85,5" href="#" alt="円">
    <area shape="poly" coords="156,109 173,154 211,146 217,120 181,99"   href="#" alt="多角形">
    </map>
    <textarea rows=5 cols=10 id=tt1></textarea>
    <script>
    var x1=156,y1=164;//A
    var x2=200,y2=85;//B
    var b=[[156,109],[173,154],[211,146],[217,120],[181,99]];
    var mx=0,my=0;//move point step
    function move(){
        if(x1+mx>x2)clearInterval(timer);
        mx++;//偏移量x
        my=(y2-y1)*mx/(x2-x1);//偏移量y
        document.getElementById("tt1").value=my
        // 起点y   +  相対偏移量x   * 斜率                              <=移動点y 
        if(Math.abs(b[0][1] + (x1+mx-b[0][0])*(b[0][1]-b[1][1])/(b[0][0]-b[1][0]))>=y1+my){ 
            alert((mx+x1)+":"+(my+y1));
            clearInterval(timer);
        }
        
    }
    var timer=setInterval(move,10);
    </script>
      

  6.   


    大哥.真神了!!.
    太崇拜你了!!。真的行。
    而且很准确。但是反方向就不行了。就是上面的点在左边。
    下面的点在右边。
    请原谅我的过份请求。如果能把这个问题解决。就太神奇了。
    JS没有像FALSH那相的碰撞函数。
    你在JS里都实现了。
    缺实让人佩服。!!!
      

  7.   

    反方向,自己判断正負号
    // 起点y   +  相対偏移量x   * 斜率                              <=移動点y 
    if(Math.abs(b[0][1] + (x1+mx-b[0][0])*(b[0][1]-b[1][1])/(b[0][0]-b[1][0]))>=y1+my){