Home > Web Front-end > JS Tutorial > When the href of link A in IE6 is javascript protocol, it does not jump to the current page_javascript tips

When the href of link A in IE6 is javascript protocol, it does not jump to the current page_javascript tips

WBOY
Release: 2016-05-16 16:45:56
Original
1182 people have browsed it

Sometimes link A is used to replace the button when switching pages. There are several advantages to doing this

By default, when the mouse is placed, there will be a hand-shaped effect (no need to add cursor:pointer)
You can add the one supported by lower versions of IE Pseudo class

If the page needs to be refreshed as a whole when clicked, that is, it will jump, then IE6 is not satisfactory, as follows

Copy code The code is as follows:

Sina


Sohu


<script> <br>function jumpSina () { <br>location.href = 'http://www.sina.com.cn' <br>} <br>function jumpSohu() { <br>location.href = 'http://www.sohu .com' <br>} <br></script>

Clicking the link cannot jump in IE6, but other browsers can. The solution is to change it to an anchor point,
Copy the code The code is as follows:

Sina


Sohu


<script> <br>function jumpSina() { <br>location.href = 'http://www.sina.com.cn' <br>} <br>function jumpSohu() { <br>location.href = 'http://www.sohu.com' <br>} <br></script>

If you change the jump mode to window.open, there will be no problem under IE6, as follows
Copy the code The code is as follows:

Sina


<script> <br>function jumpSina() { <br>window.open( 'http://www.sina.com.cn') <br>} <br></script>
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