Remove link dotted lines for comprehensive analysis and summary

Source: Internet
Author: User

In the traditional method, adding more attribute code in the tag makes modification difficult.

<A href = "link1.htm" onfocus = "this. blur ()"> link1 </a>

<A href = "link1.htm" onfocus = "this. close ()"> link1 </a>

<A href = "link1.htm" hidefocus = "true"> link1 </a>

<A href = "link1.htm" hidefocus = "hidefocus"> link1 </a>

<A href = "link1.htm" hidefocus> link1 </a> non-standard

Intermediate approach, Global Control

CSS implementation increases the burden on IE and is not recommended.

A {blr: expression (this. onFocus = this. close ());}

A {blr: expression (this. onFocus = this. blur ());}

HTC supports IE and has latency, which is not recommended

Save the following code as a file with the. htc extension.

<Public: attach event = "onfocus" onevent = "hscfsy ()"/>
<Script language = "javascript">
Function hscfsy (){
This. blur ();
}
</Script>

Style call

A {behavior: url (path of the htc file )}

Advanced approach, Global Control

Traversal implementation

Window. onload = function ()
{
For (var ii = 0; ii <document. links. length; ii ++)
Document. links [ii]. onfocus = function () {this. blur ()}
}

Encapsulate it as a function

Function fHideFocus (tName ){
ATag = document. getElementsByTagName (tName );
For (I = 0; I <aTag. length; I ++) aTag [I]. hideFocus = true;
// For (I = 0; I <aTag. length; I ++) aTag [I]. onfocus = function () {this. blur ();};
}

Currently, an attribute of hidefocus is added. The commented out sentence is to add onfucus = this. blur ();
Then call fHideFocus ("A"); To remove the dotted box of.
You can remove more dashed boxes by passing different parameters, such as "BUTTON ".
But remember to use uppercase letters for parameters.

Application Skills and questions

A. How do I eliminate the dotted line of links in the map area?

This is a conceptual error. In fact, we should control the map image, rather than in the area. Refer to the traditional method.

B. About onFocus

<A href = "http://blog.csdn.net/alonesword/" onFocus =" this. blur () ">

</A>

Here, onFocus is something to set the mouse focus event. This can be used or not, but it is recommended to make more browsers recognize it; border = 0. this is the key to removing the dotted box (on the Internet, some people use onFocus = "this. blur () "to eliminate dotted boxes, but this statement cannot be used only during local testing)

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.