Next | Index
[an error occurred while processing this directive]

Client-Side JavaScript Guide

This book explains how to use core and client-side JavaScript for version 1.3. JavaScript is Netscape's cross-platform, object-based scripting language for client and server applications.

Contents

New Features in this Release

About this Book

New Features in this Release
What You Should Already Know
JavaScript Versions
Where to Find JavaScript Information
Document Conventions

Chapter 1  JavaScript Overview

What Is JavaScript?
Core, Client-Side, and Server-Side JavaScript
Core JavaScript
Client-Side JavaScript
Server-Side JavaScript
JavaScript and Java
Debugging JavaScript
Visual JavaScript
JavaScript and the ECMA Specification
Relationship Between JavaScript and ECMA Versions
JavaScript Documentation vs. the ECMA Specification
JavaScript and ECMA Terminology

Part 1 Core Language Features

Chapter 2  Values, Variables, and Literals

Values
Data Type Conversion
Variables
Declaring Variables
Evaluating Variables
Variable Scope
Literals
Array Literals
Boolean Literals
Floating-Point Literals
Integers
Object Literals
String Literals
Unicode
Unicode Compatibility with ASCII and ISO
Unicode Escape Sequences
Displaying Characters with Unicode

Chapter 3  Expressions and Operators

Expressions
Operators
Assignment Operators
Comparison Operators
Arithmetic Operators
Bitwise Operators
Logical Operators
String Operators
Special Operators
Operator Precedence

Chapter 4  Regular Expressions

Creating a Regular Expression
Writing a Regular Expression Pattern
Using Simple Patterns
Using Special Characters
Using Parentheses
Working with Regular Expressions
Using Parenthesized Substring Matches
Executing a Global Search and Ignoring Case
Examples
Changing the Order in an Input String
Using Special Characters to Verify Input

Chapter 5  Statements

Conditional Statements
if...else Statement
switch Statement
Loop Statements
for Statement
do...while Statement
while Statement
label Statement
break Statement
continue Statement
Object Manipulation Statements
for...in Statement
with Statement
Comments

Chapter 6  Functions

Defining Functions
Calling Functions
Using the arguments Array
Predefined Functions
eval Function
isFinite Function
isNaN Function
parseInt and parseFloat Functions
Number and String Functions
escape and unescape Functions

Chapter 7  Working with Objects

Objects and Properties
Creating New Objects
Using Object Initializers
Using a Constructor Function
Indexing Object Properties
Defining Properties for an Object Type
Defining Methods
Using this for Object References
Deleting Objects
Predefined Core Objects
Array Object
Boolean Object
Date Object
Function Object
Math Object
Number Object
RegExp Object
String Object

Chapter 8  Details of the Object Model

Class-Based vs. Prototype-Based Languages
Defining a Class
Subclasses and Inheritance
Adding and Removing Properties
Summary of Differences
The Employee Example
Creating the Hierarchy
Object Properties
Inheriting Properties
Adding Properties
More Flexible Constructors
Property Inheritance Revisited
Local versus Inherited Values
Determining Instance Relationships
Global Information in Constructors
No Multiple Inheritance

Part 2 Client-Specific Features

Chapter 9  Embedding JavaScript in HTML

Using the SCRIPT Tag
Specifying the JavaScript Version
Hiding Scripts Within Comment Tags
Example: a First Script
Specifying a File of JavaScript Code
URLs the SRC Attribute Can Specify
Requirements for Files Specified by the SRC Attribute
Using JavaScript Expressions as HTML Attribute Values
Using Quotation Marks
Specifying Alternate Content with the NOSCRIPT Tag

Chapter 10  Handling Events

Defining an Event Handler
Example: Using an Event Handler
Calling Event Handlers Explicitly
The Event Object
Event Capturing
Enable Event Capturing
Define the Event Handler
Register the Event Handler
A Complete Example
Validating Form Input
Example Validation Functions
Using the Validation Functions

Chapter 11  Using Navigator Objects

Navigator Object Hierarchy
Document Properties: an Example
JavaScript Reflection and HTML Layout
Key Navigator Objects
window and Frame Objects
document Object
Form Object
location Object
history Object
navigator Object
Navigator Object Arrays
Using the write Method
Printing Output
Displaying Output

Chapter 12  Using Windows and Frames

Opening and Closing Windows
Opening a Window
Closing a Window
Using Frames
Creating a Frame
Updating a Frame
Referring To and Navigating Among Frames
Creating and Updating Frames: an Example
Referring to Windows and Frames
Referring to Properties, Methods, and Event Handlers
Referring to a Window in a Form Submit or Hypertext Link
Navigating Among Windows and Frames

Chapter 13  Additional Topics

Using JavaScript URLs
Using Client-Side Image Maps
Using Server-Side Image Maps
Using the Status Bar
Creating Hints with onMouseOver and onMouseOut
Using Cookies
Limitations
Using Cookies with JavaScript
Using Cookies: an Example
Determining Installed Plug-ins
mimeTypes Array
plugins Array

Chapter 14  JavaScript Security

Same Origin Policy
Origin Checks and document.domain
Origin Checks of Named Forms
Origin Checks and SCRIPT Tags that Load Documents
Origin Checks and Layers
Origin Checks and Java Applets
Using Signed Scripts
Introduction to Signed Scripts
Identifying Signed Scripts
Using Expanded Privileges
Writing the Script
Signing Scripts
Troubleshooting Signed Scripts
Using Data Tainting
How Tainting Works
Enabling Tainting
Tainting and Untainting Individual Data Elements
Tainting that Results from Conditional Statements

Part 3 Working with LiveConnect

Chapter 15  LiveConnect Overview

What Is LiveConnect?
Enabling LiveConnect
The Java Console
Working with Wrappers
JavaScript to Java Communication
The Packages Object
Working with Java Arrays
Package and Class References
Arguments of Type char
Controlling Java Applets
Controlling Java Plug-ins
Java to JavaScript Communication
Using the LiveConnect Classes
Accessing Client-Side JavaScript
Data Type Conversions
JavaScript to Java Conversions
Java to JavaScript Conversions

Chapter 16  LiveAudio and LiveConnect

JavaScript Methods for Controlling LiveAudio
Using the LiveAudio LiveConnect Methods

Part 4 Appendixes

Appendix A  Mail Filters

Creating the Filter and Adding to Your Rules File
News Filters
Message Object Reference
Mail Messages
News Messages
Debugging Your Filters
A More Complex Example

Appendix B  Displaying Errors with the JavaScript Console

Opening the JavaScript Console
Evaluating Expressions with the Console
Displaying Error Messages with the Console
Setting Preferences for Displaying Errors

Glossary

Index


Next | Index

Last Updated: 05/27/99 21:21:12

Copyright (c) 1999 Netscape Communications Corporation