DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> WEB網站前端 >> 前端技巧
去掉點擊鏈接時出現的虛線框的幾種方法
編輯:前端技巧     

鏈接被點擊後留下的虛線框,往往影響美觀。下面彙集幾種去除方案:

1. 直接加在標籤上

<a href="#" onfocus="this.blur()">鏈接</a>

2. 用 CSS 實現

a{blr:expression(this.onFocus=this.blur());} /* 只支持 IE,用得太多影響性能 */

a:focus { -moz-outline-style: none; } /* 火狐用,IE 不支持 */

3. 用 htc 讓 IE 支持

<public:attach event="onfocus" onevent="hscfsy()"/>
<script language="javascript">
function hscfsy(){
this.blur();
}
</script>
然後在樣式中調用 a {behavior:url(htc文件路徑)}

4. 用 JavaScript 遍歷所有鏈接

window.onload=function(){
for(var ii=0; ii<document.links.length; ii++){
document.links[ii].onfocus=function(){this.blur()}
}
}

5. WordPress 可用內置 jQuery 處理

$("a").bind("focus",function(){
if(this.blur){ this.blur(); }
});

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved