Home > Web Front-end > JS Tutorial > body text

Solution to the problem of window.location not jumping_javascript skills

WBOY
Release: 2016-05-16 16:52:03
Original
1138 people have browsed it

I encountered a problem when writing code today: the onclick event is used in HTML to realize the jump of window.location = url, and the href="javascrit:;" attribute is added to the embedded element. At this time, the jump to window.location fails. Later, I checked on the Internet, and I remembered that events in JavaScript are bubbled, which may be blocked by the embedded href event.

The solution is: add a return false statement in the onclick method to force the program to jump out and not continue to execute the following statements.

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