Features added after version 1

he following lists summarize the additions and changes to JavaScript since Navigator 2.0. The lists show new functionality and changed functionality.

Note

Language features added in Navigator 3.0 are not incorporated in LiveWire 1.0.


New functionality

The following table lists objects, properties, methods, event handlers, and other features added in JavaScript for Navigator 3.0.

Category Feature Description
New objects
Applet
Includes a Java applet in a web page

Area
Defines image maps

Array
Lets you create arrays and work with them

Boolean
Lets you work with Boolean values

FileUpload
A file upload element on an HTML form; a file upload element lets the user supply a file as input

Function
Specifies a string of JavaScript code to be compiled as a function

Image
An image on an HTML form

MimeType
A MIME type (Multipart Internet Mail Extension) supported by the client

Number
Lets you work with numeric values

Option
A Select object option created using the Option() constructor

Plugin
A plug-in module installed on the client

Object deletion
You can remove an object by setting its object reference to null. See "Object deletion".
New properties
border
A string specifying the width, in pixels, of an image border

closed
Specifies whether a window is closed

complete
A boolean value that indicates whether Navigator has completed its attempt to load an image

constructor
Specifies the function that creates an object prototype

current
A string specifying the complete URL of the current history entry

description
A description of a MIME type or plug-in

domain
Specifies the domain name of the server that served a document

enabledPlugin
The Plugin object for the plug-in that is configured for the specified MIME type

filename
The name of a plug-in file on disk

height
A string specifying the height of an image in pixels

hspace
A string specifying a margin in pixels between the left and right edges of an image and the surrounding text

lowsrc
A string specifying the URL of a low-resolution version of an image to be displayed in a document

MAX_VALUE
The maximum numeric value representable in JavaScript

MIN_VALUE
The smallest positive numeric value representable in JavaScript

NaN
A special value representing Not-A-Number. This value is represented as NaN

NEGATIVE_INFINITY
A special numeric value representing negative infinity; this value is represented as "-Infinity"

next
A string specifying the complete URL of the next history entry

opener
Specifies the window of the calling document when a window is opened using the open method

POSITIVE_INFINITY
A special numeric value representing infinity. This value is represented as "Infinity"

previous
A string specifying the complete URL of the previous history entry

prototype
Defines a property that is shared by all objects of the specified type

src
A string specifying the URL of an image to be displayed in a document

suffixes
A string listing possible file suffixes (also known as file name extensions) for the MIME type

type
Specifies the type of form element or the name of a MIME type

vspace
A string specifying a margin in pixels between the top and bottom edges of an image and the surrounding text

width
A string specifying the width of an image in pixels
New arrays
applets
Reflects all the <APPLET> tags in a document in source order

embeds array
Reflects all the <EMBED> tags in a document in source order

history array
Reflects all the history entries in a window in source order

images
Reflects all the <IMG> tags in a document in source order (images created with the Image() constructor are not included in the images array)

mimeTypes
Reflects all the MIME types supported by the client (either internally, via helper applications, or by plug-ins)

plugins
Reflects all the plug-ins installed on the client in source order
New methods
javaEnabled
Specifies whether Java is enabled

join
Joins all elements of an array into a string

refresh
Makes newly installed plug-ins available, updates related arrays such as the plugins array, and optionally reloads open documents that contain plug-ins

reload
Forces a reload of the window's current document

replace
Loads the specified URL over the current history entry

reset method
Simulates a mouse click on a reset button

reverse
Transposes the elements of an array: the first array element becomes the last and the last becomes the first

scroll
Scrolls a window to a specified coordinate

sort
Sorts the elements of an array

split
Splits a String object into an array of strings by separating the string into substrings

taintEnabled
Specifies whether data tainting is enabled

valueOf
Returns the primitive value of an object
New functions
taint
Adds tainting to a data element or script

untaint
Removes tainting from a data element or script
New event handlers
onAbort
Executes JavaScript code the user aborts the loading of an image

onError
Executes JavaScript code when the loading of a document or image causes an error

onMouseOut
Executes JavaScript code when the mouse pointer leaves an area (client-side image map) or link

onReset
Executes JavaScript code when a reset event occurs

Resetting event handlers from within JavaScript
In JavaScript for Navigator 3.0, you can reset an event handler specified by HTML from within JavaScript. See "Calling event handlers explicitly".
New operators
typeof
Returns the data type of its operand

void
Specifies an expression to be evaluated without returning a value
New HTML tags and attributes
JavaScript entities
JavaScript entities for HTML attribute values. See "Using JavaScript expressions as HTML attribute values".

SRC attribute of <SCRIPT> the tag
Allows you to use JavaScript code in an external file. See "Specifying a file of JavaScript code".

LANGUAGE attribute of <SCRIPT> the tag
Allows you to specify the JavaScript version. See "Specifying the JavaScript version".

<NOSCRIPT> tag
Displays alternate content for old browsers or when the user has disabled JavaScript in Navigator. See "Specifying alternate content with the NOSCRIPT tag".
Java-JavaScript communication
LiveConnect
LiveConnect enables communication between JavaScript and Java applets in a page and between JavaScript and plug-ins loaded on a page. See Chapter 4, "LiveConnect."
Plug-in detection
Determining installed plug-ins
You can use JavaScript to determine whether a user has installed a particular plug-in. You can also determine whether a client is capable of handling a particular MIME (Multipart Internet Mail Extension) type. See "Determining installed plug-ins".
Security
Data tainting
Navigator prevents scripts from fetching private information such as directory structures or user session history. Data tainting retains the security restriction but provides a means of secure access to specific components on a page. See "Using data tainting for security".


Changed functionality

The following table lists changes to functionality that existed in JavaScript for Navigator 2.0.

Category Feature Description
Objects
Form object
Added reset method; added onReset event handler

Frame
Added blur, focus, and scroll methods; added onBlur, onError, and onFocus event handlers

history object
Added current, next, and previous properties

Link object
Added onMouseOut event handler

location
Added reload and replace methods; changed the way documents are loaded when location is set

navigator
Added mimeTypes and plugins arrays; added javaEnabled method

Object prototypes (see prototype)
Added ability to create properties to be shared by all objects of the same type

Select object
Programmatically modifiable Select objects and the ability to add options and delete options

String
Added String() constructor (in previous releases, you construct strings by quoting characters); added prototype property; added split method; added ability to pass strings among scripts in different windows or frames (in previous releases, you had to add an empty string to another window's string to reference it)

window object
Added closed and opener properties; added blur, focus, and scroll methods; added onBlur, onError, and onFocus event handlers

Indexing object properties
If you initially define a property by its name, you must always refer to it by its name, and if you initially define a property by an index, you must always refer to it by its index. See "Indexing object properties".
Properties
Indexing arrays with strings
Added ability to index arrays using strings (as in an associative array). See "Navigator's object arrays", "Array object", and "Array".
Methods
blur
Now works for window, frame, Button, Checkbox, FileUpload, Radio, Reset, and Submit objects

close (window object)
Has new security enhancements

eval
Now a method of every object (was previously a built-in function); it evaluates a string of JavaScript code in the context of the specified object

focus
Now works for window, frame, Button, Checkbox, FileUpload, Radio, Reset, and Submit objects

open (document object)
Added "replace" parameter, which causes the new document to reuse the history entry that the previous document used; document.open() or document.open("text/html") now clears the current document if it has finished loading

random
Now works on all platforms

toString
Added radix parameter, which specifies the base to use for representing numeric values

write
Users can print and save generated HTML using the commands on the File menu

writeln
Users can print and save generated HTML using the commands on the File menu
Functions
isNaN
Now works on all platforms (in previous releases, worked only on Unix platforms)

parseFloat
Now returns NaN on all platforms if the first character of the specified string cannot be converted to a number; in previous releases, it returned NaN on Solaris and Irix and zero on all other platforms

parseInt
Now returns NaN on all platforms if the first character of the specified string cannot be converted to a number; in previous releases, it returned NaN on Solaris and Irix and zero on all other platforms
Event handlers
onBlur
Now applies to window, frame, Button, Checkbox, FileUpload, Radio, Reset, and Submit objects

onClick
Added the ability to return false to cancel the action associated with a click event

onFocus
Now applies to window, frame, Button, Checkbox, FileUpload, Radio, Reset, and Submit objects