Page 164 - CITS - Computer Software Application -TT
P. 164
COMPUTER SOFTWARE APPLICATION - CITS
catch(err) {
document.getElementById(“demo”).innerHTML = err.name;
}
Type Error
A TypeError is thrown if an operand or argument is incompatible with the type expected by an operator or function.
Example
let num = 1;
try {
num.toUpperCase(); // You cannot convert a number to upper case
}
catch(err) {
document.getElementById(“demo”).innerHTML = err.name;
}
URI (Uniform Resource Identifier) Error
A URIError is thrown if you use illegal characters in a URI function:
Example
try {
decodeURI(“%%%”); // You cannot URI decode percent signs
}
catch(err) {
document.getElementById(“demo”).innerHTML = err.name;
}
Non-Standard Error Object Properties
Mozilla and Microsoft define some non-standard error object properties:
fileName (Mozilla)
lineNumber (Mozilla)
columnNumber (Mozilla)
stack (Mozilla)
description (Microsoft)
number (Microsoft)
Do not use these properties in public web sites. They will not work in all browsers.
Concept of AJAX
AJAX is a developer’s dream, because you can:
• Read data from a web server - after a web page has loaded
• Update a web page without reloading the page
• Send data to a web server - in the background
HTML Page
<!DOCTYPE html>
<html>
151
CITS : IT&ITES - Computer Software Application - Lesson 37 - 46