Home >Web Front-end >JS Tutorial >Comprehensive analysis and summary of removing dotted lines from links_javascript skills
The traditional method of adding attributes to tags requires a lot of code and is difficult to modify. 🎜>
link1
link1 Non-standard
Intermediate approach, global control CSS implementation added IE burden, not recommended to use
a{blr:expression(this.onFocus=this.close());} a{blr:expression(this.onFocus=this.blur( ));}
HTC implements IE support, and there is a delay. It is not recommendedSave the following code as a file with the extension .htc
function hscfsy(){
this.blur();
}
Style call
a {behavior :url(path address of htc file)}
Advanced method, global control<script><BR>Traversal implementation <BR><BR>window.onload=function() <BR>{ < /script> for (var ii=0; ii<document.links.length; ii ) <br> document.links[ii].onfocus=function(){this.blur()} <br>} <br><br>Change it Encapsulated as a function <br><br>function fHideFocus(tName){ <br>aTag=document.getElementsByTagName(tName); <br>for(i=0;i<aTag.length;i )aTag[i]. hideFocus=true; <br>//for(i=0;i<aTag.length;i )aTag[i].onfocus=function(){this.blur();}; <br>} <BR><BR>Currently, a hidefocus attribute is added. The commented out sentence is to add onfucus=this.blur(); <document.links.length; ii ) <BR>Then call fHideFocus("A"); to remove the dotted frame of a <BR>By passing different For parameters, you can remove more dotted boxes. For example, "BUTTON" can remove the <br> of the button, but remember that the parameters must be in capital letters <br><br>Application tips and questions<br><BR>A. map area How to remove link dashed lines? <BR><aTag.length;i )aTag[i].hideFocus=true; <BR>This is a conceptual error. In fact, it should be controlled on the image in the map, not in the area. Refer to the traditional method <aTag.length;i )aTag[i].onfocus=function(){this.blur();}; <BR><br>B. About onFocus <br><BR> <BR> <BR><br> <br><br> <br><br> Among them, onFocus is what sets the mouse focus event. This can be used or not, but in order to allow more browsers to recognize it, , it is recommended to use; Border=0 This is the key to removing the dotted frame (I saw on the Internet that some people use onFocus="this.blur()" to eliminate the dotted frame, but when testing locally, just using this sentence is cannot be eliminated) <br><br></script>