The request in The onclick event processing in IE6 is aborted

Source: Internet
Author: User

The <A> label is often used in development to replace the button. The advantage is that the: hover style can be used for the Mouseover effect, but the followingCodeIn IE6, the request in onclick is aborted.
<A href = "javascript: void (0);" onclick = "$ ('current '). src = 'images/001.jpg '; "> switch images </a>. IE6 images are not displayed.
<A href = "javascript: void (0);" onclick = "myjrjrelation. checkattention ();"> follow this person </a>. The request fails in IE6.

When you click a link, The onclick event is triggered first and then href is executed. The void (0) Here terminates the onclick request. This Bugs has been fixed in IE7.

Solution:
1. Do not use onclick, but ensure that the processing function does not return values. Otherwise, the browser will clear the page and only display the function results. If checkattention returns false, the browser displays false.
<A href = "javascript: myjrjrelation. checkattention ();"> follow this person </a>

<A href = "javascript: void (myjrjrelation. checkattention ();"> follow this person </a>Void returns undefined;

2. Add return false to onclick to prevent the browser from executing href. The href attribute is required. Otherwise, the link style becomes invalid.
<A href = "javascript: void (0);" onclick = "myj1_relation. checkattention ();Return false; "> Follow this person </a>

To sum up<A href = "javascript: void (0);" onclick = "myjrjrelation. checkattention (); Return false;">The best compatibility.

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.