Remove the dotted box implementation code after tag a is clicked

Source: Internet
Author: User
The code is as follows: Copy code
A {blr: expression (this. onFocus = this. blur ();/* IE Opera */outline: none;/* FF Opera */} a: focus {-moz-outline-style: none; /* FF */}
 
 
Implement a {blr: expression (this. onFocus = this. close ();}/* only supports IE, which is inefficient when used too much */a {blr: expression (this. onFocus = this. blur ();}/* only supports IE, which is inefficient when used too much */a: focus {-moz-outline-style: none;}/* IE does not support */
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////
When a link gets the focus, a dotted box is created by default. As shown in the following figure:
In Firefox, you can use-moz-outline: none; or outline: none; to remove it. So we can write:
The code is as follows: Copy code
A: focus {
Outline: none;
-Moz-outline: none;
}

By the way, if you have used Safari and Chrome, you may find that the border will have a shadow effect when the input box gets the focus.
You can also use the outline attribute to remove the shadow effect.
The code is as follows: Copy code
Input, textarea {
Outline: none;
}

Let's get down to the truth. I just talked about Firefox. Now I want to talk about IE. First of all, it is a pity that we have not found a better solution to remove the IE link dashed box through CSS. Therefore, only one alternative is to use the hidefocus attribute of the tag (this attribute is unique to IE ).
The code is as follows: Copy code
<A href = "#" hidefocus = "true"> Link </a>
Note: The attribute name corresponding to the JS script is hideFocus. The corresponding JS code should be:
The code is as follows: Copy code
Xxx. hideFocus = 'true ';
There is another method that is not recommended. That is, the focus is lost when the link gets the focus.
The code is as follows: Copy code
<A href = "#" onfocus = "this. blur ();"> Link </a>
This method works very well, but it is too violent and it is best not to use it.
 
You can add onFosuc = this in each <a> . blur ();, but if we need to solve the hyperlinked dashed lines of the entire site in batches and add such code one by one, we don't have to be dizzy.

Three solutions are available:
First, the DW plug-in scrubber. mxp can be used to process hyperlinks on the entire page, but the dotted box cannot be eliminated on the entire site, which has limitations.

Second, use a style sheet to process the entire site.
Style Code:
The code is as follows: Copy code
A {blr: expression_r (this. onFocus = this. blur ())}
For the image area, you can add:
The code is as follows: Copy code
Area {blr: expression_r (this. onFocus = this. blur ())}
Everything is done.

Third, you can also use the htc file to add the. style. behavior attribute. For example:
The code is as follows: Copy code
<Style>
A, img
{
Behavior: url (js file address );
}
</Style>

Write the following statement into the js file:
The code is as follows: Copy code
<Attach event = "onFocus" handler = "onFocus"/>
<SCRIPT language = "javascript">
Function onFocus ()
{
This. blur ();
}
</SCRIPT>

---------------------
No savior recommended:
Method 2
Use a style sheet to process the entire site.
Style Code:
The code is as follows: Copy code
A {blr: expression_r (this. onFocus = this. blur ())}
For the image area, you can add:
The code is as follows: Copy code
Area {blr: expression_r (this. onFocus = this. blur ())}
Everything is done.

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.