|
|
|||||
|
Learn Java Script Today | | | Over 5000 Free Fonts | | | Tutorials | | | Javascript Forum | | | Other Javascript Resources | | | Cheat Sheet |
Error processing SSI file |
|
[Contents] [Previous] [Next] [Last]IntroductionThis document describes the changes and new features for JavaScript in Navigator 4.0.
Feature SummaryEvent ModelThe event model, as described in Chapter 1, "Event Model," has changed to include a newevent object, new
events, and event capturing.
captureEvents --sets
the window or document to capture the specified events.
disableExternalCapture --disables
external event capturing set by the enableExternalCapture
method.
enableExternalCapture --allows
a window with frames to capture events in pages loaded from different locations (servers).
releaseEvents --sets
the window or document to release the specified events.
Objects that receive events have these new methods for event capturing: routeEvent --routes
the event from its capturer through its normal event hierarchy.
handleEvent --fires
the event handler for the specified event.
Click *--occurs
when a user clicks a link or form element.
DblClick --occurs
when a user double-clicks over a link or form element.
DragDrop --occurs
when a user drops an object onto a Navigator window.
KeyDown --occurs
when a user depresses a key.
KeyPress --occurs
when a user presses or holds down a key.
KeyUp --occurs
when a user releases a key.
MouseDown --occurs
when a user depresses a mouse button.
MouseMove --occurs
when a user moves the cursor.
MouseOut *--occurs
when a user moves the cursor out of an object.
MouseOver *--occurs
when a user moves the cursor over an object.
MouseUp --occurs
when a user releases a mouse button.
Move --occurs
when a user or script moves a window.
Resize --occurs
when a user or script resizes a window.
Functions
Number --converts
a specified object to a number.
String --converts
a specified object to a string.
LayersLayers, new in Navigator 4.0, let you define overlapping layers of transparent or solid content in a web page. Each layer in HTML has a corresponding layer object that allows you to use JavaScript to manipulate the layer. MethodsArray Methodsconcat --joins
two arrays and returns a new array.
pop
removes the last element from an array and returns that element.
push
adds one or more elements to the end of an array and returns that last element added.
shift
removes the first element from an array and returns that element
unshift
adds one or more elements to the front of an array and returns the new length of the
array.
slice --extracts
a section from an array and returns a new array
splice --adds
and/or removes elements from an array and returns the removed elements.
sort *--now
works on all platforms. It no longer converts undefined elements to null; instead, it
sorts them to the high end of the array.
Document MethodgetSelection --returns
a string containing the text of the current selection.
Navigator Methodpreference --allows
a script to get and set certain Navigator preferences, such as enabling or disabling Java.
String Methods
charCodeAt --returns
a number specifying the ISO-Latin-1 codeset value of the character at the specified index
in a string object.
concat --combines
the text of two strings and returns a new string.
fromCharCode --constructs
a string from a specified sequence of numbers that are ISO-Latin-1 codeset values.
match --executes
a search for a match between a string and a regular expression.
replace --executes
a search for a match between a string and a regular expression, and replaces the matched
substring with a new substring.
search --tests
for a match between a string and a regular expression
slice --extracts
a section of an string and returns a new string.
split *--includes
the following new features and changes:
substr --returns
the characters in a string collecting the specified number of characters beginning with a
specified location in the string.
substring *--if
you specify LANGUAGE="JavaScript1.2" in the <SCRIPT>
tag, this method no longer swaps index numbers when the first index is greater than the
second.
Window Methods
back --undoes
the last history step in any frame within the top-level window, not just backing up a step
in the frame in which the call to back occurs.
clearInterval --cancels
setInterval.
disableExternalCapture --disables
external capturing of events.
enableExternalCapture --allows
a window with frames to capture events in pages loaded from different locations.
find --finds
the specified text string in the contents of the window.
forward --points
the Navigator window to the next URL in the current history list.
home --points
the Navigator window to the URL specified in the preferences as the user's home page.
moveBy --moves
the window by the specified amount
moveTo --moves
the window to the specified coordinates
open --includes
the following new window features:
print --prints
the contents of the window.
resizeBy --resizes
the window by the specified amount
resizeTo --resizes
the window to the specified size
scrollBy --scrolls
the window by the specified amount
scrollTo --scrolls
the window to the specified coordinates
scrollTo
replaces scroll . scroll remains for backward compatibility
setInterval --repeatedly
calls a function or evaluates an expression after a specified number of milliseconds has
elapsed.
setTimeout *--can
now be used to either evaluate an expression or call a function.
stop --stops
the current download.
Shared Methodseval --no
longer a method of individual objects; only available as a global function.
watch --new
method of all objects. Watches for a property to be assigned a value and runs a function
when that occurs.
unwatch --new
method of all objects. Removes a watchpoint set with the watch method.
captureEvents --window
and document method. Sets the window or document to capture the specified
events.
handleEvent --method
of all objects with event handlers. Invokes the handler for the specified event.
releaseEvents --window
and document . Sets the window or document to release the specified events.
routeEvent --window
and document method. Passes a captured event along the normal event
hierarchy.
toString *--converts
the object or array to a literal. For this behavior, LANGUAGE="JavaScript1.2"
must be specified in the <SCRIPT> tag.
Objects
arguments --includes
new properties that provide information about the invoked function.
Array *--includes
the following new features and changes:
<SCRIPT> tag includes LANGUAGE="JavaScript1.2" ,
array(1) creates a new array with a[0]=1
With
regular expressions--When created as the result of a match between a regular
expression and a string, arrays have new properties that provide information about the
match
Number *--now
produces NaN rather than an error if x is a string that does not contain a well-formed
numeric literal.
screen --contains
information about the display screen resolution and colors.
String *--has
new methods as described in "String
Methods" on page 12.
Operators
== and != )
If the delete --deletes
an object property or an element at a specified index in an array.
PropertiesAnchor and Link PropertyFunction Propertyarity --indicates
the number of arguments expected by a function.
Navigator Propertieslanguage --indicates
what translation of the Navigator is being used. This property is particularly useful for
JAR management.
platform --indicates
the machine type for which the Navigator was compiled. This property is particularly
useful for JAR management.
Window Properties
innerHeight --specifies
the vertical dimension, in pixels, of the window's content area; replaces height .
innerWidth --specifies
the horizontal dimension, in pixels, of the window's content area; replaces width .
locationbar --object
that allows you to show or hide the location bar of the targeted window.
menubar --object
that allows you to show or hide the menu bar of the targeted window.
outerHeight --specifies
the vertical dimension, in pixels, of the window's outside boundary.
outerWidth --specifies
the horizontal dimension, in pixels, of the window's outside boundary.
pageXOffset --specifies
the x-position, in pixels, of the window's viewed page.
pageYOffset --specifies
the y-position, in pixels, of the window's viewed page.
personalbar --object
that allows you to show or hide the personal bar (also known as the directories bar) of
the targeted window.
scrollbars --object
that allows you to show or hide the scroll bars of the targeted window.
statusbar --object
that allows you to show or hide the status bar of the targeted window.
toolbar --object
that allows you to show or hide the tool bar of the targeted window.
Regular ExpressionsRegular Expressions are patterns used to match character combinations in strings. In JavaScript, you create a regular expression as an object which has methods used to execute a match against a string. You can also pass the regular expression as arguments to theString methods match , replace , search ,
and split . The RegExp construction object has properties most of
which are set when a match is successful, such as lastMatch which specifies
the last successful match. Finally, the Array object has new properties that
provide information about a successful match such as input which specifies
the original input string against which the match was executed.
Signed ScriptsFor additional power and functionality, scripts can now gain access to normally restricted information. This is achieved through signed scripts that request expanded privileges. This new functionality provides greater security than data tainting. Data tainting has been removed from JavaScript 1.2. Statements
break *
and continue *
statements can now be used with the new labeled statement.
do
while --repeats a loop until the test condition evaluates to false.
export --allows
a signed script to provide functions to other signed or unsigned scripts.
import --allows
a script to import functions from a signed script which has exported the information.
labeled --allows
the program to break outside nested loops or to continue a loop outside the current loop.
switch --allows
the program to test several conditions easily.
Style SheetsUsing style sheets, you gain finer control over the presentation of your web pages. Navigator 4.0 supports two syntaxes for designing style sheets: Cascading Style Sheets (CSS) and JavaScript style sheets. CSS is the static approach to specifying style and JavaScript is the programmatic approach. Miscellaneous
Compatibility With Earlier Versions of NavigatorAs JavaScript evolves along with Navigator, its capabilities expand greatly. This means
that JavaScript written for Navigator 4.0 may work in Navigator 4.0 only. To ensure that
users of earlier versions of Navigator avoid problems when viewing pages that use
JavaScript 1.2, use the <SCRIPT> tag are ignored
if the browser does not have the level of JavaScript support specified in the LANGUAGE
attribute; for example:
By using the [Contents] [Previous] [Next] [Last] |
|