Remove link Gridlines: Style sheet method and HTC method

Source: Internet
Author: User
Tags html page object model

When the link points to a page target, we click on the link, and a virtual box appears around it, and so does the text link and the link to the picture. Removing gridlines can be implemented with JavaScript This.blur (), however, each hyperlink statement is written with This.blur () the workload will be very large, we need to find an efficient way.

IE has been supporting the concept of Web behavior from version 5.5. These behaviors are described by a script file with a suffix named. HTC, which defines a set of methods and attributes that programmers can apply to almost any element on an HTML page. Web behavior is great because they allow programmers to "connect" custom functionality to existing elements and controls, rather than having to have users download binaries (such as ActiveX controls) to do this. Web behavior is also a recommended way to extend the IE object model and control set. Microsoft offers several custom Web behaviors in the DHTML Behavior Library section of its developer site: WebService behavior.

We are using the above. htc file to easily achieve mass removal of the chain of virtual frames. The following is saved as a file with a suffix of. HTC (please change full-width punctuation to small angle when used):

<public:attach event="onfocus" onevent="quit()" />
<script language="javascript">
function quit(){
this.blur();
}
</script>

Then, add the and between the pages that need to remove the hyperlink gridlines:

<style type="text/css">
a {behavior:url("htc文件")}
</style>

If the page already has a style tag, simply insert a {behavior:url ("HTC File")} into it.

In this way, the page's hyperlink after the click of the virtual box will no longer exist, the page appears clean.

When you remove a virtual box from a link, you can remove the annoying virtual frame of the link by adding the following code to your style sheet

a,area { blr:expression(this.onFocus=this.blur()) } /* for IE */
:focus { -moz-outline-style: none; } /* for Firefox */ 

is not very simple.

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.