Home >Web Front-end >JS Tutorial >Three ways to remove the dotted box of IE links using JS CSS_Basic knowledge

Three ways to remove the dotted box of IE links using JS CSS_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 17:15:161226browse

Method 1: Use the onfocus event of javascript to implement as follows:
Html code

Copy code The code is as follows:

If you introduce the jQuery framework, you can use its event binding mechanism:
Js code
Copy code The code is as follows:

$('a').bind('focus', function(){
if(this.blur){ //If this is supported. blur
this.blur();
}
});


Method 2: Use css style to implement the following :
Css code
Copy code The code is as follows:

a{
blr: expression( this.onFocus=this.close());
} /* Only supports IE, excessive use is inefficient*/
a{
blr: expression(this.onFocus=this.blur()) ;
} /* Only supports IE, excessive use is inefficient*/
a:focus {
-moz-outline-style: none;
} /* IE does not support*/
:focus {
outline: none;
} /* for Firefox */


Method 3: Use tag attributes, only supports IE, the implementation is as follows: Html code
Copy code The code is as follows:

Method 4: HTC implementation is as follows:
Save the following code as .htc Suffixed file
Js code
Copy code The code is as follows:




CSS code
Copy code The code is as follows:

a {behavior:url("htc file")}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn