Home > Web Front-end > JS Tutorial > Solution to window.location.href jump failure under IE_javascript skills

Solution to window.location.href jump failure under IE_javascript skills

WBOY
Release: 2016-05-16 16:54:13
Original
1559 people have browsed it
Copy code The code is as follows:

GoNext
$("a").click(function(){
window.location.href = "xxx.html";
})

The code is as above. Under IE, especially in IE6, after clicking the hyperlink, the browser does not jump.

The reason may be the event behavior blocked by javascript:void(0) in href. The solution is as follows:

1. Add return false to the onclick event to prevent bubbling:
Copy code The code is as follows:

$("a").click(function(){
window.location.href = "xxx.html";
reutrn false;
})

2. Delay 100 milliseconds
Copy code The code is as follows:

$("a").click(function(){
setTimeout(function(){
window.location.href = "xxx.html";
},100);
})
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