去除链接元素的虚线框 兼容IE7、IE6、FF

推荐下面的代码

a {outline: none; /* for Forefox */ }  
a {star:expression(this.onFocus=this.blur()); /* for Ie*/ }

下面的代码比较麻烦
我们采用htc文件的办法来解决这个问题。首页将以下代码保存为link.htc文件。  
 

<public:attach event="onfocus" onevent="hscfsy()"/>   
<script language="javascript">   
function hscfsy(){   
this.blur();   
}   
</script>  
 
  在HTML文件中写入以下代码,建立一个链接:  
<a href="#" title="来客网">laike.net</a>  
  我们开始为此链接定义CSS样式:  

a {   
  display:block;   
  width:100px;   
  height:30px;   
  line-height:30px;   
  text-align:center;   
}  
a:hover {   
  background:#ddd;  
}  
  CSS样式确定了链接的外观,具有一定宽度与高度的块元素。文字水平左右均居中对齐。  
  我们在a标签的样式内,加入一条属性。用此消除链接的虚线边框:  

a {   
  display:block;   
  width:100px;   
  height:30px;   
  line-height:30px;   
  text-align:center;   
  behavior:url(line.htc);  
}  
  我们运行以下代码查看效果:  

我们在IE7、IE6中预览,已经没有问题了。但是在FF中虚线框依然存在。 
  我们新增一条样式定义来解决此问题。 

a:focus { outline:0; }

查看最终的运行效果: 

在IE7、IE6、FF中均成功实现了消除链接的虚线框。