Javascript development-essential for preventDefault-javascript skills

Source: Internet
Author: User
Adding preventDefault to the click Event of the button for a to block the default behavior of the browser seems to be necessary in the impression. If this is not added, it seems that only ie6 has encountered problems. See: changed the image address, the image disappears, the style is loaded, but the style file is gone. Just like the download of A resource is interrupted. The correct explanation is that when you use element A in IE6 as A button, remember to call preventDefault () in the onclick event (), IE6 will force the current active HTTP connection to close, leading to abnormal loading of other resources or scripts being requested. However, if the resource has been cached, this problem will not occur.

The Code is as follows:







In ie6, the image will appear. If you click to change the image src, the image will not appear. preventDefault or return false is required.
Click to change image address

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.