Professional Documents
Culture Documents
Scripting Language
Introduction
A compact, object-based scripting language for developing client and server Internet applications Two Types :
1. Navigator JavaScript, also called client-side JavaScript embedded in an HTML page LiveWire JavaScript, also called server-side JavaScript enables you to create server-based applications similar to Common Gateway Interface (CGI) programs
2.
JavaScript in Navigator
Netscape Navigator 2.0 (and later versions)
interpret JavaScript statements embedded in an HTML page
When Navigator requests such a page, the server sends the full content of the document, including HTML and JavaScript statements, over the network to the client The Navigator then displays the HTML and executes the JavaScript, producing the results that the user sees
Client-side JavaScript
Can respond to user events such as mouseclicks, form input, and page navigation For example:
You can write a JavaScript function to verify that users enter valid information into a form requesting a telephone number or zip code Without any network transmission, the HTML page with embedded JavaScript can check the entered data and alert the user with a dialog box if the input is invalid
JavaScript
1. Interpreted (not compiled) by client 2. Object-based. Uses built-in, extensible objects, but no classes or inheritance 3. Code integrated with, and embedded in, HTML 4. Variable data types not declared (loose typing)
And
Java
1. Compiled bytecodes downloaded from server, executed on client 2. Object-oriented. Applets consist of object classes with inheritance 3. Applets distinct from HTML (accessed from HTML pages)
4. Variable data types must be 5. Dynamic binding. Object declared (strong typing) references checked at runtime
6. Cannot automatically write to hard disk
5. Static binding. Object references must exist at compile-time 6. Can write to hard disk
A document can have multiple SCRIPT tags, and each can enclose any number of JavaScript statements
Hello, net!