Home >Web Front-end >Front-end Q&A >How to ignore error messages in javascript

How to ignore error messages in javascript

藏色散人
藏色散人Original
2021-10-14 17:13:382668browse

How to ignore error prompts in JavaScript: 1. Open the corresponding front-end code file; 2. Place the "function ResumeError() {...}" code in the head to block JAVASCRIPT error prompts.

How to ignore error messages in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to ignore error messages in javascript?

SHIELD JAVASCRIPT error prompts

Sometimes there will be JavaScript script running errors, but for some reasons, debugging is very troublesome, or you are too lazy to deal with some If there are errors and these errors do not affect the operation, these errors can be masked. Put this code in the head, and then the JavaScript code referenced later will not prompt if there is an error.

<SCRIPT LANGUAGE=&#39;JavaScript&#39;>
<!--
//屏蔽js错误
function ResumeError() {
return true;
}
window.onerror = ResumeError;
// -->
</SCRIPT>

Of course, it is better to correct the mistake in the end. This is only a last resort.

Recommended study: "javascript basic tutorial"

The above is the detailed content of How to ignore error messages in javascript. For more information, please follow other related articles on the PHP Chinese website!

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