Home >Web Front-end >JS Tutorial >Methods to abort javascript execution_javascript tips

Methods to abort javascript execution_javascript tips

WBOY
WBOYOriginal
2016-05-16 17:00:111259browse

JS does not have PHP’s exit, nor does JAVA’s return.

If the JS code is not a function and you need to abort JS execution, there is only one way, and that is:

document.location.href=your_url;

In addition, although throw can be terminated, it is still an unfriendly error message. Therefore, if you want to terminate it in a friendly manner, you can only use the above method.

Therefore, non-function mode code cannot stay on the current page to implement abort.

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