Home > Web Front-end > JS Tutorial > JavaScript Development Essay 1: The Necessity of PreventDefault_javascript Skills

JavaScript Development Essay 1: The Necessity of PreventDefault_javascript Skills

WBOY
Release: 2016-05-16 17:58:54
Original
1072 people have browsed it

If you don't add it, it seems that the problem only occurs in ie6. It has happened: changing the image address, the image disappeared, loading the style, but the style file is gone. Just like interrupting the download of resources, the correct explanation is that when using the A element as a button under IE6, you must remember to call preventDefault() in the onclick event. IE6 will forcefully close the currently active HTTP connection, resulting in the request being Other resources or scripts are not loading properly. But if the resource has been cached, there will be no such problem

Copy code The code is as follows:






will appear in ie6, click Changing the image src causes the image not to appear. You need to preventDefault or return false


Click to change the image address




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template