Web page
As you all know,onfocus= "This.blur ()" This code can eliminate links when the dotted box, but have you ever thought that if you have several or even hundreds of links on the page, and you want to remove the above nasty dotted line box, you also go to CTRL + C, Ctrl + V, God! This is definitely a nightmare for a normal person. You might say, "Find/Replace" in DW or other text editors can be solved, yes! Admittedly, this is a good idea, but as a good web developer, with as few code as possible to achieve the same functionality is the goal we should pursue, the following we use HTC to solve this problem. As for HTC, the full name is HTML components, a new set of instructions that Microsoft began to offer after IE5.0, which encapsulates code for a particular function in a single component, enabling reuse of code. As a component, HTC contains the attributes, methods, events, and so on a variety of knowledge, here is not one of the details, you can refer to the Microsoft MSDN homepage.
Back to the beginning,Onfocus=this.blur () Obviously, Onfocus is an event, This.blur () is an object triggered by events, and since this is clear, the code knows what to write.
<public:attach event= "onfocus" onevent= "example ()"/>
<script language= "JavaScript" >
function Example () {
This.blur ();
}
</script>
Save the above code as an. htc file with an extension, and then write an ordinary HTML page
<style>
A {Behavior:url (the path address of the HTC File)}
</style>
<body>
<a href= "#" > Links 1</a>
<a href= "#" > Links 2</a>
<a href= "#" > Links 3</a>
Click the link to try, there is no dotted box it
</body>
OK, save, preview, how? The effect came out, and then look at the code, indeed a lot of streamlining, and in the link more and more manifest more obvious. Finally, I would like to say that this is only the tip of the HTC application of the iceberg, more features you need to know, I believe that a bit of JS and CSS based on you will be able to learn.