去掉点击链接时出现的虚线框的几个方法

建站知识 2021-07-03 09:08www.168986.cn长沙网站建设
在这介绍几种去除的方法:

直接给链接加是
onfocus=”this.blur()”.
<a href="#" onfocus="this.blur()">链接</a>

CSS实现

复制代码
代码如下:

a{blr:expression(this.onFocus=this.close());} /* 只支持IE,过多使用效率低 */
a{blr:expression(this.onFocus=this.blur());} /* 只支持IE,过多使用效率低 */
a:focus { -moz-outline-style: none; } /* IE不支持 */

htc实现IE支持

复制代码
代码如下:

<public:attach event="onfocus" onevent="hscfsy()"/>
<script language="javascript">
function hscfsy(){
this.blur();
}
</script>

调用 a {behavior:url(htc文件所在路径地址)}

通过JavaScript遍历实现

复制代码
代码如下:

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

5.对WordPress可以用内部的JQuery框架来去除

复制代码
代码如下:

$("a").bind("focus",function(){
if(this.blur){ //如果支持 this.blur
this.blur();
}
});

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by

长沙网络推广|微博营销|长沙seo优化|视频营销|长沙网络营销|微信营销|长沙网站建设|口碑营销|软文营销