Method onfocus = "this. blur ()"

Source: Internet
Author: User
How to batch remove "dotted boxes" on Webpage connections"

Everyone knows that onfocus = "this. blur () "can be used to eliminate the dotted line boxes when linking, but have you ever wondered if there are several or even hundreds of links on your webpage, and you want to remove the above annoying dotted boxes, do you still need to Ctrl + C, Ctrl + V one by one, oh, my God! This is definitely a nightmare for a normal person. You may say that using the "Search/Replace" function in DW or other text compilers can solve the problem! It is undeniable that this is a good method, but as a good web developer, using as few code as possible to implement the same function is what we should pursue, next we will use htc to solve this problem. As for what htc is, the full name is Html Components, a new command combination provided by Microsoft after IE5.0. It can encapsulate the code of a specific function in a component, the code can be reused. As a component, htc contains various knowledge such as attributes, methods, and events. We will not discuss them here. For details, refer to Microsoft's msdn homepage.

Return to the start, Onfocus = this. blur () Here it is clear that onfocus is an event, this. blur () is the object triggered by the event. Since this is clear, the code knows how to write it.

<Public: attach event = "onfocus" onevent = "example ()"/>
<Script language = "javascript">

Function example (){
This. blur ();
}
</Script>
Save the above Code as a file with the. htc extension, and then write a common html webpage.
<Html>
<Head>
<Style>
A {behavior: url (path of the htc file )}
</Style>
<Body>
<A href = "#"> link 1 </a>
<A href = "#"> link 2 </a>
<A href = "#"> link 3 </a>
Click the link and try again. There is no dotted box.
</Body>
</Html>
OK, save and preview. How can this problem be solved? The results have come out. Let's look at the code, which is indeed a lot simpler, and the more links there are, the more obvious it is. The last thing I want to talk about is that this is only the tip of the iceberg on htc applications. You Need To Know More functions. I believe you can certainly learn something based on JS and CSS.

Link: http://hi.baidu.com/skznandy/blog/item/23ee8e28163e3ff498250aad.html

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.