Home > Article > Web Front-end > How to ignore error messages in javascript
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.
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='JavaScript'> <!-- //屏蔽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!