html裡,如何去掉點擊map裡area的邊框

來源:互聯網
上載者:User

標籤:

html代碼

<img src="../images/account/safe_part_1.png" width="990" height="334" usemap="#safeMap"/>
<map name="safeMap" id="safeMap">
  <area shape="rect" coords="4,191,156,233" href="http://www.cadf.org.cn/" target="_blank" />
  <area shape="rect" coords="163,191,320,233" href="http://hk.shmzj.gov.cn/" target="_blank"/>
  <area shape="rect" coords="322,191,480,233" href="http://www.yintongcard.com/ytcard/zh_CN/index.html" target="_blank"/>

  <area shape="rect" coords="4,240,156,282" href="http://cn.unionpay.com/" target="_blank"/>
  <area shape="rect" coords="163,240,320,282" href="http://www.chinaums.com/" target="_blank"/>
  <area shape="rect" coords="322,240,480,282" href="http://www.chinapay.com/" target="_blank"/>

  <area shape="rect" coords="4,291,156,333" href="http://www.cpic.com.cn/cpic/index.shtml" target="_blank"/>
  <area shape="rect" coords="164,291,321,333" href="http://www.pingan.com/index.shtml" target="_blank"/>
  <area shape="rect" coords="327,291,480,333" href="http://www.spdb.com.cn/" target="_blank"/>
</map>

效果:

問題:

當滑鼠移到map的area上,滑鼠點擊下去時,會有一個藍色的邊框

方案:

在需要去掉邊框的<area>標籤中加入onfocus="blur(this);"

分析:onfocus 事件在對象獲得焦點時發生,那麼blur(this)則是讓當前對象失去焦點。而那個滑鼠按下出現的藍色邊框則是焦點線了。

註:一般為了頁面美觀和效果一致,要去掉這種html標籤內建的效果。但是,通常情況下,盡量不要刻意去除。

若是要在每一個aera上加入,僅用js做一下處理

$(function(){

  $.each($("#safeMap area"),function(i,val){
    $(val).attr({"onfocus":"blur(this)"});

  })

})

html裡,如何去掉點擊map裡area的邊框

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.