Scripting

The most common scripting technology in browsers today is JavaScript. JavaScript, one part of the Java technology revolution, is an implementation of a scripting language that has its roots in the Java programming language. JavaScript was intended to be easier to learn and to use than Java; the first users of JavaScript would be interested mainly in enhancing user interfaces and would have more of an authoring background than a programming one.

The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript's runtime environment is also smaller and has fewer data types than Java does. JavaScript is object based, not objected oriented, meaning that it uses built-in extensible objects but does not support user-defined classes or inheritance. Because JavaScript is not compiled, it uses dynamic binding, and all object references are checked at runtime. JavaScript supports functions without special declarative requirements. This makes it easier for those new to programming to use.

JavaScript comes embedded in HTML pages, so it needs to coexist in the document, as does any other element of the document. The is required to mark the end of the region. Because the

Unfortunately, defining scripts is not as simple as that. Not all browsers are JavaScript capable, and even though a browser is built to be robust and fault tolerant, the earliest browsers do not gracefully handle JavaScript that they can't interpret. The problem stems from the fact that if it doesn't understand a tag, a browser ignores it. For the most part, this works well. For example, a browser that doesn't understand the tag just ignores it and continues to use the default font. A problem occurs when an older browser ignores the

The last line in the script block is a JavaScript comment and is there only so that the HTML comment end token (-->) is ignored by the JavaScript interpreter. Like polyglot programs that compile error free under multiple languages, this code needs to behave well for both HTML and JavaScript.

JavaScript Objects

Категории