Special Edition Using HTML 4: JavaScript Keyword Reference

By Rick Darnell

Terms

While not necessarily JavaScript objects or keywords, the following items can help in your understanding of JavaScript and how it works. These are the general terms that are used in most discussions about JavaScript and its implementation.

Cookie  A special object containing state/status information about the client that can be accessed by the server. Included in that state object is a description of the range of URLs for which that state is valid. Future HTTP requests from the client falling within a range of URLs described within the state object will include transmission of the current value of the state object from the client back to the server. This simple form of data storage allows the server to provide personalized service to the client. Online merchants can store information about items currently in an electronic shopping basket, services can post registration information and automate functions such as typing a user ID, and user preferences can be saved on the client and retrieved by the server when the site is contacted. For limited-use information, such as shopping services, it is also possible to set a time limit on the life of the cookie information.

CGI scripts are typically used to set and retrieve cookie values. To generate the cookie requires sending an HTTP header in the following format:

Set-Cookie: NAME=Value; 
[EXPIRES=date;] [PATH=pathname;] 
[DOMAIN=domainname;] [SECURE]

When a request for cookie information is made, the list of cookie information is searched for all URLs which match the current URL. Any matches are returned in this format:

cookie: NAME1=string1; 
NAME2=string2; ...

Cookie was an arbitrarily assigned name. For more information about the cookie and its function, see http://home.netscape.com/newsref/std/cookie_spec.html.

Event Handler  Attributes of HTML tags embedded in documents. The attribute assigns a JavaScript command or function to execute when the event happens.

Function  A user-defined or built-in set of statements that perform a task. It can also return a value when used with the return statement.

Hierarchy  Navigator objects exist in a set relation to each other that reflects the structure of an HTML page. This is referred to as instance hierarchy because it only works with specific instances of objects, rather than general classes. The window object is the parent of all other Navigator objects. Underneath window, location, history, and document all share precedence. Document includes forms, links, and anchors.

Each object is a descendant of the higher object. A form called orderForm is an object, but is also a property of document. As such, it is referred to as document.orderForm.

Java  An object-oriented, platform-independent programming language developed by Sun Microsystems and used to add additional functionality to Web pages. Programming in Java requires a Java Development Kit with compiler and core classes. Although Java started out as a language intended for writing Web applets, more and more stand-alone Java applications are being created.

JavaScript  A scripting language developed by Netscape for HTML documents. Scripts are performed after specific user-triggered events. Creating JavaScript Web documents requires a text editor and compatible browser.

Literal  An absolute value not assigned to a variable. Examples include 1, 3.1415927, "Bob", true.

Method  A function assigned to an object. For example, bigString.toUpperCase() returns an uppercase version of the string contained in bigString.

Object  A construct with properties that are JavaScript variables or other objects. Functions associated with an object are known as the object's methods. You access the properties of an object with a simple notation:

objectName.propertyName

Both object and property names are case sensitive.

Operator  Performs a function on one or more operands or variables. Operators are divided into two classes: binary and unary. Binary operators need two operands, and unary operands can operate on a single operand. For example, addition is a binary operand:

sum = 1 + 1

Unary operands are often used to update counters. The following example increases the variable by 1:

counter++

Property  Used to describe an object. A property is defined by assigning it a value. There are several properties in JavaScript that contain constants: values that never change.

Script  One or more JavaScript commands enclosed with a <script> tag.

© Copyright Macmillan Computer Publishing. All rights reserved.

Make a Comment

Loading Comments...

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
  •  
  •  
  •  
Thanks for your registration, follow us on our social networks to keep up-to-date