JS Exception Description (Get exception) __js

Source: Internet
Author: User
JS Exception Description (Get exception)
<div id= ' bbb ' style= ' display:none ' >asdf</div>
<script>
function A ()
{
try
{
var aaa = document.getElementById (' BBB ');
alert (aaa.innertext);
}
catch (E)
{
alert (' ERROR ' + E.message + ' occurs on ' +   E.linenumber + ' line ');
}
A ();
</script>
*
JS exception e In addition to E.message and E.linenumber also has an important attribute e.name
e.name error type,
e.message The details of the error.
Error.name's six values correspond to information:
1. The use of Evalerror:eval () is inconsistent with the definition
2. Rangeerror: The value crosses
3. Referenceerror: Illegal or unrecognized reference value
4. SyntaxError: Syntax resolution error
5 occurred. TypeError: Operand type error
6. Improper use of Urierror:uri processing functions
so your JS code to run to catch the exception of the code, even if the code is wrong, will continue to run the code, will not stop, and the use of the exception to JS debugging also has some help.
*/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.