Use JS css to remove IE link dashed box three ways _ Basics

Source: Internet
Author: User

method One: Use JavaScript's onfocus event to achieve the following:
HTML code

Copy Code code as follows:

<a href= "http://www.jb51.net/" onfocus= "This.blur ();" > Design Honeycomb </a>

If you introduce the jquery framework, you can leverage its event-binding mechanism:
JS Code
Copy Code code as follows:

$ (' a '). Bind (' Focus ', function () {
if (This.blur) {//If support This.blur
This.blur ();
}
});


method Two: Using CSS style, to achieve the following
CSS Code
Copy Code code as follows:

a{
Blr:expression (This.onfocus=this.close ());
}/* only supports IE, excessive use efficiency low * *
a{
Blr:expression (This.onfocus=this.blur ());
}/* only supports IE, excessive use efficiency low * *
A:focus {
-moz-outline-style:none;
}/* IE does not support * *
: Focus {
Outline:none;
}/* for Firefox * *


method Three: The use of tag properties, only support IE, to achieve the following: HTML code
Copy Code code as follows:

<a href= "http://www.jb51.net/" hidefocus= "true" > Design honeycomb </a>

Method Four: HTC implementation is as follows:
Save the code as an. HTC suffix file
JS Code
Copy Code code as follows:

<public:attach event= "onfocus" onevent= "Quit ()"/>
<script language= "JavaScript" >
function quit () {
This.blur ();
}
</script>

CSS Code
Copy Code code as follows:

A {behavior:url ("HTC File")}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.