Home  >  Article  >  Web Front-end  >  The problem of switching images by clicking on a tag under IE6_javascript skills

The problem of switching images by clicking on a tag under IE6_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:16:381012browse

However, most domestic users are still using IE6.

When switching an image through the onclick event of the a tag under IE6, there may be a problem that the image cannot be loaded. The performance result of httpwatch crawling is abort.

Tested it and found a solution.

A tag event is generally written like this, or it may be a binding event. The solution is the same:

1. a1

2. a2

3. a3

The third method dosomething() has no problem switching pictures, but href="###" does It brings another problem, it occupies the anchor point and the page URL is not beautiful.

Although the first and second methods do not have the above problems, they will cause strange bugs in IE6. The images in dosomething() cannot be loaded.

Just add a return false; after dosomething(); to solve the problem.

If it is a binding event, also add return false; at the end of the function.

Statement:
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