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)