Student: Dixie Darlin

Week One

Spring 2003

My first Javascript

What is JavaScript?

A compact, object-based scripting language which allows one to make web pages with which a visitor can interact
A client-side language, JavaScript is fast because there is no waiting for data to be sent to and retrieved from the server.
The code resides within the Web page and runs on the user's computer which makes for nearly instantaneous results.

Who invented Java?

Invented by Netscape as a joint effort with Sun Micro- systems
The web's first true scripting language
Originally called "LiveWire"

Language Explanation

A "programming language" is a set of grammatical statements and rules that allows one to give instructions to a computer.

A "markup language" defines sections of text so that they appear in a certain style or manner.

A "scripting language" is a hybrid, similar to programming language in that it provides a set of instructions, yet it also resembles a markup language in that it is less complex and has rules which are less strict.

How is javascript different from Java?

This table illustrates the basic differences between Java and JavaScript:


JavaScript Java
Interpreted (not compiled) by client Compiled on server before execution on client
Object-based. Code uses built-in, extensible objects, but no classes or inheritance Object-oriented. Applets consist of object classes with inheritance
Code integrated with, and embedded in, HTML Applets distinct from HTML (accessed from HTML pages)
Variable data types not declared (loose typing) Variable data types must be declared (strong typing)
Dynamic binding. Object references checked at run-time Static binding. Object references must exist at compile-time
Cannot automatically write to hard disk Cannot automatically write to hard disk

What can't javascript do?

1) JavaScript cannot be used to access or control someone's computer.
2) You cannot use JavaScript to write data to a user's hard drive.
3) Ordinary text cannot be executed

What can javascript do?

JavaScript can be used to create a "browser cookie" on a user's computer

How is javascript activated?

1) IMMEDIATE
Place the full JavaScript code between the HTML opening and closing tags.
Remember to declare JavaScript functions and variables in the opening and closing tags,
and then embed the statements that call the functions or reference the variables between the opening and closing tags.
This enables the variables and functions declared in the header be loaded and initialized so that they are available to the rest of the script.

2) EXTERNAL FILE
Specify an external file that contains your scripts.
Specify a JavaScript expression as a value for an HTML attribute.

3) EMBEDED
Placement of the scripts within some HTML tags as event handlers


Rules

CAPITALIZATION - JavaScript IS case-sensitive
OPENING SYMBOLS - require matching closing symbols: in JavaScript
open and closed symbols must work in pairs.
COMMENTS - documentation of the code and/or make notes about what a script is doing
NOTE: Anything between the double slashes and the end of the line character that gets inserted when you press the RETURN or ENTER key is invisible to JavaScript.
STATEMENTS - Every statement has the same structure
JavaScript scripts typically consists of a series of statements. A statement is a single line of instruction to the computer.
COMMAND BLOCKS - treated as a single entity and follows the same structure
These are groups of statements. At times, individual statements will be grouped into command blocks. A command block is like a paragraph in English.

a darlin Creation
by Dixie