Cover | Table of Contents
|
Version
|
Navigator
|
Internet Explorer
|
|---|---|---|
|
2
|
JavaScript 1.0
| |
|
3
|
JavaScript 1.1
|
JavaScript 1.0
|
|
4
|
JavaScript 1.2; not fully ECMA-262 compliant prior to version 4.5
|
JavaScript 1.2;EMCA-262 compliant
|
|
Version
|
Navigator
|
Internet Explorer
|
|---|---|---|
|
2
|
JavaScript 1.0
| |
|
3
|
JavaScript 1.1
|
JavaScript 1.0
|
|
4
|
JavaScript 1.2; not fully ECMA-262 compliant prior to version 4.5
|
JavaScript 1.2;EMCA-262 compliant
|
/* and */ is a comment, and is ignored by
JavaScript. Also, any text between // and the end of the current line
is a comment, and is ignored. Examples:// This is a single-line, C++-style comment. /* * This is a multi-line, C-style comment. * Here is the second line. */ /* Another comment. */ // This too.
_ ) and dollar sign ($) characters. The first
character of an identifier must not be a digit, however, and the $
character is not allowed in identifiers in JavaScript 1.0. The
following are legal identifiers:var
statement:var i; var j = 1+2+3; var k,l,m,n; var x = 3, message = 'hello world';
1 3.14 .0001 6.02e23
0, and a hexadecimal literal begins with 0x:0377 // The number 255 in octal 0xFF // The number 255 in hexadecimal
NaN, which represents a value
that is not-a-number. Use the global function isNaN() to test for
this value.true and false. These values represent truth or
falsehood, on or off, yes or no, or anything else that can be
represented with one bit of information."1+2 total/n sum(o.x, a[3])++ (1+2)*3
|
P
|
A
|
Operator
|
Operation Performed
|
|---|---|---|---|
|
15
|
L
|
. |
Access an object property
|
|
L
|
[] |
Access an array element
| |
|
L
|
() |
Invoke a function
| |
|
14
|
R
|
++ |
Unary pre- or post-increment
|
|
R
|
-- |
Unary pre- or post-decrement
| |
|
R
|
- |
Unary minus (negation)
| |
s = "hello world"; x = Math.sqrt(4); x++
while loop consists of a single
statement. If you want the loop to execute more than one statement,
use a compound statement. This is a common technique with
if, for, and other statements described later.break and
continue statements:
label : statement
break
break statement terminates execution of the innermost enclosing
loop, or, in JavaScript 1.2, the named loop:break ; break label ; // JavaScript 1.2
case
case is not a true statement. Instead it is a keyword used to label
statements within a JavaScript 1.2 switch statement:(/), or as a JavaScript string
passed to the RegExp( ) constructor. The optional g (global search)
and i (case-insensitive search) modifiers may follow the second /
character, or may be passed to RegExp( ).|
Character
|
Meaning
|
|---|---|
\n,\r,\t |
Match literal newline, carriage return, tab
|
\\, \/, \*, \+, \?, etc. |
Match a special character literally, ignoring or escaping its special
meaning
|
[ . . . ] |
Match any one character between brackets
|
[^ . . . ] |
Match any one character not between brackets
|
. |
Match any character other than newline
|
\w, \W |
Match any word/non-word character
|
\s, \S |
Match any whitespace/non-whitespace
|
\d, \D |
Match any digit/non-digit
|
^, $ |
Require match at beginning/end of a string, or in multi-line mode,
beginning/end of a line
|
\b,\B |
Require match at a word boundarynon-boundary |
<SCRIPT> tag<SCRIPT> tag and a </SCRIPT> tag. The
<SCRIPT> tag can also be used to include an external file of
JavaScript code into an HTML document. The <SCRIPT> tag
supports a number of attributes, including these three important
ones:"JavaScript". You must set
it if you are mixing scripting languages, such as JavaScript and
VBScript.SRC attribute. Supported in JavaScript 1.2 and later. Archives
are required to use Navigator 4 signed scripts.
onClick eventsonClick eventsonChange
events(<INPUT TYPE=password>)
onChange eventsonClick eventsonClick eventsonChange eventsonClick events|
Event Handler
|
Supported By
|
|---|---|
onAbort |
Image (JavaScript 1.1)
|
onBlur, onFocus |
Text elements; Window and all other form elements (1.1)
|
onChange |
Select, text input elements
|
onClick |
Button elements, Link. Return
false to cancel
default action. |
onDblClick |
Document, Link, Image, Button elements (1.2)
|
onError |
Image, Window (1.1)
|
onKeyDown, onKeyPress, onKeyUp |
Document, Image, Link, text elements (1.2). Return
false to cancel. |
onLoad, onUnload |
Window; Image in 1.1
|
onMouseDown, onMouseUp |
Document, Link, Image, Button elements (1.2). Return
false to cancel. |
onMouseOver, onMouseOut |
Link; Image and Layer (1.2). Return
true to
prevent URL display. |
onReset, onSubmit |
UniversalBrowserRead.UniversalBrowserRead.UniversalBrowserRead.mailto: or news: URL without user
confirmation or UniversalSendMail.UniversalBrowserWrite.about: URLs, such as about:cache, without
UniversalBrowserRead.UniversalBrowserWrite.UniversalBrowserWrite.Infinity
NaN
escape
(s)
eval
(code)
getClass
(javaobj)
isFinite
(n)
NaN
(x)
parseFloat
(s)
parseInt
(s, radix)
unescape
(s)
document.anchors[i] document.anchors.length
name
text
x
y
document.applets[i] document.appletName
Return to JavaScript Pocket Reference