[Contents]

Symbols

# (hash mark in URL) 240
% operator 97
& operator 98
*/ comment 128, 132
-- operator 97
++ operator 97
/* comment 128, 132
// comment 27, 128, 132
^ operator 98
| operator 98
~ operator 98

A

A HTML tag 58, 157
about: (URL syntax) 274, 275
abs method 153
absolute value 153
acos method 153
ACTION attribute 154, 220
action property 154
alert method 36, 45, 155
alinkColor property 155
anchor method 156
Anchor object 157
See also anchors
anchors
Anchor object 157
creating 156
defining 157
linking to 58
anchors array 158
anchors property
See anchors array
appCodeName property 160
Applet object 161
applets array 163
appName property 164
appVersion property 164
arc cosine 153
arc sine 173
arc tangent 173
Area object 165
arguments array 108, 169
arithmetic operators
decrement 97
increment 97
modulus 96
unary negation 97
Array object 171
arrays
anchors 158
applets 163
arguments 108, 169
Array object 171
associative 106
defined 73
defining 73
elements 47, 205
embeds 318
forms 46,  221
frames 52, 53, 228
images 252
length of 263
links 268
mimeTypes 282
options 345
plugins 317, 320
populating 74
ASCII, string value 208, 393
asin method 173
assignment operators 95
defined 93
atan method 173
atan2 method 174

B

Back button 174
back method 174
background color 175
bgColor property 175
BIG HTML tag 176
big method 176
bitwise operators
logical 98
overview 98
shift 99
BLINK HTML tag 176
blink method 176
blur event 33, 289
blur method 177
BODY HTML tag 28
BOLD HTML tag 178
bold method 114, 178
Boolean literals 90
border property 179
break statement 125, 132
browser
about: (URL syntax) 275
code name of 160
hiding scripts from 27
name of 164
navigator object 288
user agent 394
version of 164
Button object 180
See also buttons
buttons
Button object 180
clicking programmatically 187
defining 180
reset 334
submit 33, 38, 374

C

case sensitivity 27, 89, 105
ceil method 181
CGI programs
and image maps 80
and server JavaScript 24
submitting forms to 38
validating form input for 36
change event 33, 291
charAt method 182
Checkbox object 183
See also checkboxes
checkboxes
Checkbox object 183
checking programmatically 186
clicking programmatically 187
default selection state 195
defining 183
selection state 186
checked property 186
clearTimeout method 83, 187
click event 33, 292
click method 187
client JavaScript 23
close method 45
document object 188
window object 50, 189
colors
background 175
font 217
foreground 212
hexadecimal values 413
link 155, 271, 400
list of 413
string literals 413
string literals for 413-418
text 212
commas, in cookies 75
comment statement 128, 132
comments 27, 132
types of 128
comparison operators 95
complete property 190
compute function 36
conditional expressions 94
conditional statements 121-122
confirm method 35, 45, 191
containership
specifying default object 127, 140
with statement and 127, 140
continue statement 125, 133
conventions 131
cookie property 191
cookies 191
defined 75
example of use 77
with JavaScript 76
limitations for 76
cos method 193
cosine 193

D

data types
converting 88
and Date object 87
in JavaScript 26, 87
Date object 194
See also dates, times
creating 116
overview 116
using 81-83
dates
See also times
converting to string 388
cookie expiration 75
Date object 194
day of month 234
day of week 235
defining 194
GMT conversion 387
milliseconds since 1970 309, 395
month 236
working with 116
year 238, 361
decrement operator 97
default objects, specifying 127, 140
defaultChecked property 195
defaultSelected property 196
defaultStatus property 80, 198
defaultValue property 199
description property 200
dialog boxes
Alert 45, 155
Confirm 35, 45, 191
Prompt 46, 322
directories, conventions used 18
document conventions 18-19
document object 41, 201
See also documents
anchors array 158
applets array 163
described 46
embeds array 318
example of properties 41-43
forms array 221
images array 252
links array 268
documents
See also windows
anchors array 158
anchors in 158
applets array 163
applets in 163
closing 188
color of 175, 212
current URL 394
defining 201
displaying HTML output in 201
document object 46, 201
embeds array 318
forms array 221
images array 252
images in 252
last modified date 262
links array 268
onUnload event handler 297, 303
opening 303
title 387
writing to 407, 409

E

E property 205
elements array 47, 205
elements property
See elements array
else statement
See if...else statement
embeds array 318
enabledPlugin property 207
encoding property 208
ENCTYPE attribute 208, 220
escape function 75, 77, 208
escaping characters 91
Euler's constant 205
base 10 logarithm of 277
base 2 logarithm of 277
raised to a power 211
eval function 36, 88, 209
overview 118
event handlers 289-303
See also the individual event handlers
defining 33
defining functions for 34
example of use 35-36
onAbort 289
onBlur 289
onChange 291
onClick 292
onError 293
onFocus 296
onLoad 297
onMouseOut 299
onMouseOver 300
onReset 301
onSelect 302
onSubmit 302
onUnload 303
quotation marks for 34
referring to windows 56
scripting 33-36
specifying object names in 189
syntax for 34
events, defined 33
exp method 211
expressions
conditional 94
overview 93
types of 93

F

fgColor property 212
file: (URL syntax) 274
filename property 212
FileUpload object 213
fixed method 215
floating-point literals 90
floor method 215
focus
giving 216
onBlur event handler 289
onChange event handler 291
onFocus event handler 296
removing 177
focus event 33, 296
focus method 216
fontcolor method 217
fonts
big 176
blinking 176
bold 178
color of 217
fixed 215
italic 259
size of 218
small 362
strikeout 370
subscript 373
superscript 378
FONTSIZE HTML tag 218
fontsize method 218
for loops
continuation of 125, 133
sequence of execution 122
syntax of 133
termination of 125, 132
for statement 122-123, 133
for...in statement 126, 134
foreground color 212
form elements
updating 32
updating dynamically 45
FORM HTML tag 41, 58, 219
Form object 219
See also forms
described 46
elements array 47, 205
form submit, referring to windows 58
forms
ACTION attribute 154, 220
buttons 180
checkboxes 183
defining 219
destination URL 154
element focus 177, 216
element names 285
elements array 47, 205
ENCTYPE attribute 208, 220
Form object 46, 219
forms array 46, 221
Hidden object 241
METHOD attribute 220, 281
MIME encoding 208, 220
number of elements 263
onSubmit event handler 302
Password objects 312
radio buttons 326
reset buttons 334
resetting values 334
selection lists 342
submit buttons 374
submitting 373, 374
TARGET attribute 220
target property 379
Text objects 380
Textarea objects 384
validating input 36
forms array 46, 221
forms property
See formsarray
Forward button 225
forward method 225
FRAME HTML tag 45, 58
frame names, linking to 58
Frame object 226
See also frames
described 45
frames array 228
frames
closing 50
creating 51
defined 51
defining 226
example of creation 54-55
figure of 51
Frame object 45, 226
frames array 52, 53, 228
hierarchy of 52
navigating 54
parent 308
referring to 54, 56-58
top 389
updating 53
frames array 52, 53, 228
frames property
See frames array
FRAMESET HTML tag 51, 226
ftp: (URL syntax) 274
function keyword 29, 106
Function object 231
function statement 135
functions 153-409
See also the individual functions
arguments array 169
calling 29-30
defined 29
defining 29-30
defining and calling 106-108
escape 208
eval 118, 209
examples of 36
excess arguments for 108
isNAN 258
number of arguments 263
parseFloat 120, 310
parseInt 120, 311
recursive 107
return values of 138
unescape 393
using built in 118-120
using validation 37-38

G

getDate method 234
getDay method 117, 235
getHours method 82, 235
getMinutes method 82, 236
getMonth method 236
getSeconds method 82, 237
getTime method 117, 237
getTimezoneOffset method 238
getYear method 238
Go menu 239, 243
go method 47, 239
gopher: (URL syntax) 274

H

hash property 240
HEAD HTML tag 28, 107
height property 240
Hidden object 241
history list 47
loading URL from 239
next URL in 225
previous URL in 174
History menu option 239
history object 41, 243
described 47
number of entries 263
host property 244
hostname property 245
HREF attribute 79
href property 246
hspace property 248
HTML
embedding JavaScript in 27-28
and JavaScript 17
HTML layout 44-45
HTML tags
A 58, 157
BIG 176
BLINK 176
BODY 28
BOLD 178
FONTSIZE 218
FORM 41, 58, 219
FRAME 45, 58
FRAMESET 51, 226
HEAD 28, 107
I 259
IMG 79
INPUT 180, 183, 241, 312, 326, 334, 374, 380
MAP 79
PRE 32
SCRIPT 27, 28
SELECT 342
SMALL 362
STRIKE 370
SUB 373
SUP 378
TEXTAREA 384
TITLE 42
TT 215
http: (URL syntax) 274
hypertext
See links
HyperText Markup Language
See HTML

I

I HTML tag 259
if...else statement 121, 135
image maps
client-side 79
server-side 79
Image object 248
images array 252
IMG HTML tag 79
increment operator 97
index property 257
indexOf method 257
INPUT HTML tag 180, 183, 241, 312, 326, 334, 374, 380
integers, in JavaScript 90
ISMAP attribute 79
isNaN function 258
italics method 259

J

Java
communication with JavaScript 61-72
compared to JavaScript 26
javaEnabled method 260
JavaScript
background for using 17
communication with Java 61-72
compared to Java 26
described 25
embedding in HTML 27-28
and HTML layout 44-45
LiveWire 24-25
Navigator 23-24
reserved words 411
special characters 91
types of 23
URLs 78
javascript: (URL syntax) 274, 275
join method 261

K

keywords 411

L

LANGUAGE attribute 27
language, specifying 27
lastIndexOf method 261
lastModified property 262
layout, HTML 44-45
left shift operator 99
length property 113, 263
link method 114, 266
Link object 266
See also links
linkColor property 271
links
anchors for 156, 157
color of 155, 271, 400
creating 58
defining 266
image maps 79
Link object 266
links array 268
referring to windows 58
target 379
links array 268
links property
See links array
lists, selection 342
literals
Boolean 90
floating point 90
integers 90
overview 89
string 90
LiveConnect 61-72
LiveConnect packages 141-151
LiveWire applications, validating form input for 36
LiveWire JavaScript
See server JavaScript
LN10 property 272
LN2 property 272
load event 33, 297
location object 41, 272
described 47
location property 53, 394
log method 276
LOG10E property 277
LOG2E property 277
logarithms
base 10 of e 277
base 2 of e 277
base of natural 205, 211
natural logarithm of 10 272
natural logarithm of 2 272
natural logarithm of a number 276
logical operators
overview 100
short-circuit evaluation 101
loop statements
for 122-123
while 124
loops
continuation of 125, 133
for 133
for...in 126, 134
termination of 125, 132
while 139
lowercase 27, 89, 388
lowsrc property 277

M

mailto: (URL syntax) 274
MAP HTML tag 79
Math object 279
overview 115
mathematical constants and functions 279
max method 280
messages
Alert dialog box 45, 155
Confirm dialog box 45, 191
Prompt dialog box 46, 322
status bar 80
METHOD attribute 43, 220, 281
method property 281
methods 153-409
See also the individual methods
defined 30
defining 111
referring to windows 56
MIME encoding 208
MimeType object 281
mimeTypes array 282
min method 284
modulo function 97
modulus operator 96
mouseOver event 33, 300

N

NAME attribute 43
name property 285
natural logarithms
base of 205
e 205
e raised to a power 211
of 10 272
of 2 272
of a number 276
Navigator
See also Navigator 2.0
about: (URL syntax) 275
code name of 160
mimeTypes in 282
name of 164
navigator object 288
plug-ins in 317
user agent 394
version of 164
Navigator 2.0
See also Navigator
and arrays 73
and JavaScript 23, 24
printing script 32
Navigator JavaScript
See client JavaScript
navigator object 41, 288
See also Navigator
mimeTypes array 282
plugins array 317, 320
Netscape packages 141-151
new operator 74, 101, 109, 136
news: (URL syntax) 274
null keyword 94
numbers
absolute value of 153
arc cosine of 153
arc sine of 173
arc tangent of 173
cosine of 193
evaluating 118
exponents of 321
greater of two 280
isNAN 258
lesser of two 284
natural logarithm of 276
obtaining integer 181, 215
parsing from strings 120, 310, 311
random 329
rounding 337
sine of 361
square root 366, 367
tangent of 379

O

object manipulation statements
for...in 126
new operator 127
this keyword 127
with statement 127
objects 153-409
See also the individual objects
adding properties 110
creating new types 109-111, 136
establishing default 127, 140
focus 177, 216
hierarchy of 39
overview 105
specifying names in event handlers 189
onAbort event handler 289
onBlur event handler 33, 289
onChange event handler 33, 36, 37, 291
onClick event handler 33, 36, 37, 78, 292
onError event handler 293
onFocus event handler 33, 296
onLoad event handler 33, 82, 297
onMouseOut event handler 299
onMouseOver event handler 33, 81, 300
onReset event handler 301
onSelect event handler 33, 302
onSubmit event handler 33, 38, 302
onUnload event handler 33, 303
open method 45
document object 303
window object 49, 305
opener property 307
operators
arithmetic 96
assignment 95
bitwise 98-100
comparison 95
defined 93
logical 100
order of 103
overview 94
special 101
string 101
Option object
See Select object
options array 345
options property
See options array
output
displaying 32
printing 32
output stream
closing 188
opening 303

P

packages 141-151
pages
objects for 41
updating 32
parent property 56, 308
parse method 118, 309
parseFloat function 88, 310
overview 120
parseInt function 88, 311
overview 120
Password object 312
default value 199
pathname property 314
PI property 115, 315
Plugin object 316
plugins array 317, 320
port property 320
pow method 321
PRE HTML tag 32
printing 32
prompt method 46, 322
properties 153-409
See also the individual properties
naming 43
overview 105
referring to 41
referring to windows 56
protocol property 322
prototype property 323

Q

quotation marks
for string literals 90
using double 34
using single 34

R

radio buttons
clicking programmatically 187
default selection state 195
defining 326
number of buttons 263
Radio object 326
selecting programmatically 186
selection state 186
Radio object 326
See also radio buttons
number of buttons 263
random method 329
referrer property 330
reflection 44-45
reload method 330
replace method 332
reserved words 411
reset buttons
See also buttons
clicking programmatically 187
defining 334
Reset object 334
reset method 333
Reset object 334
See also reset buttons
return statement 30, 138
reverse method 337
RGB color values 413
right shift operators 100
round method 337

S

SCRIPT HTML tag 27, 28
scripts
example of 28
hiding 27
scroll method 339
search property 340
select event 33, 302
SELECT HTML tag 342
select method 341
Select object 342
See also selection lists
options array 345
selected property 353
selectedIndex property 354
selection lists
default selection state 196
defining 342
number of options 263
option index 257
option text 383
options array 345
Select object 342
selection state 353
self property 56, 355
semicolons
for event handlers 34
in cookies 75
in JavaScript 28
server JavaScript 24
setDate method 356
setDay method 117
setHours method 356
setMinutes method 357
setMonth method 357
setSeconds method 358
setTime method 117, 118, 358
setTimeOut method 46
setTimeout method 83, 359
setYear method 361
sin method 361
sine 361
SMALL HTML tag 362
small method 362
sort method 362
space characters, in cookies 75
special operators 101
new 101
typeOf 102
void 103
split method 365
SQL 25
sqrt method 366
SQRT1_2 property 367
SQRT2 property 367
square roots 366
of 1/2 367
of 2 367
src property 367
statements 131-140
See also the individual statements
break 125
conditional 121-122
continue 125
for...in 126
loop 122-126
object manipulation 126-128
overview 121-128
syntax conventions 131
status bar
default message 198
displaying hints 81
displaying messages 46, 80
setting message 369
status property 46, 80, 369
STRIKE HTML tag 370
strike method 370
string literals 90
String object 370
See also strings
overview 113
string operators 101
strings
ASCII value of 208, 393
blinking 176
bold 178
character position within 182, 257, 261
color of 217
converting from date 388
converting to binary 311
converting to floating point 310
defining 370
evaluating 209
fixed font 215
fontsize of 176, 218, 362
italic 259
length of 263
lowercase 388
strikeout 370
String object 370
subscript 373
subset of 376
superscript 378
uppercase 391
Structured Query Language 25
SUB HTML tag 373
sub method 373
submit buttons
See also buttons
clicking programmatically 187
defining 374
event handlers for 33
Submit object 374
submit event 33, 302
submit method 38, 373
Submit object 374
See also submit buttons
subscripts 373
substring method 114, 376
subwindows, updating 32
suffixes property 377
SUP HTML tag 378
sup method 378
superscripts 378
syntax conventions 131

T

tan method 379
tangent 379
TARGET attribute 58, 220
target property 379
text color 212
Text object 380
default value 199
defining 380
text property 383
TEXTAREA HTML tag 384
Textarea object 384
default value 199
defining 384
event handlers for 33
this keyword 34, 38, 109, 111, 138
described 127
for object references 112
time zones 238
timeouts
canceling 187
setting 359
times
See also dates
Date object 194
defining 194
hours 235
minutes 236
numeric value 237
seconds 237
time zone offset 238
working with 116
TITLE HTML tag 42
title property 387
toGMTString method 75, 387
toLocaleString method 388
toLowerCase method 388
top property 56, 389
toString method 390
toUpperCase method 114, 391
trigonometric methods
acos 153
asin 173
atan 173
cos 193
sin 361
tan 379
TT HTML tag 215
type property 392
typeOf operator 102
typographical conventions, used in this book 19

U

unary negation 97
unescape function 75, 77, 393
unload event 33, 303
uppercase 27, 89, 391
URLs
anchor name in 240
calling document's 330
conventions used 18
current 272, 394
domain 245
entire URL string 246
examples of common 274
form destination 154
form field input 220
history list 243
host 245
hostname:port 244
IP address 245
javascript: 78
loading from history list 239
next 225
port 320
previous 174
protocol 322
query information 340
syntax of 273, 274
url-path 314
user interaction
Alert dialog box 155
buttons 180
checkboxes 183
Confirm dialog box 191
Prompt dialog box 322
radio buttons 326
reset buttons 334
selection lists 342
submit buttons 374
Text objects 380
Textarea objects 384
userAgent property 394
UTC method 395

V

value property 395
values
See data types
var statement 89, 138
variables
declaring 89, 138
initializing 138
in JavaScript 89
naming 89
scope of 89
syntax for declaring 138
vlinkColor property 400
void operator 103
vspace property 400

W

while loops
continuation of 125, 133
syntax of 139
termination of 125, 132
while statement 124, 139
width property 401
window object 41, 401
See also windows
described 45
frames array 228
methods of 45
window property 406
windows
See also documents
closing 50, 189
default status message 198
defining 305, 401
displaying HTML output in 201
frames 226
frames array 228
giving focus to 59
name of 285
naming 50, 56
navigating among 59
number of frames 263
onLoad event handler 297
onUnload event handler 303
opening 49, 305
overview 49
referring to 56-58
status bar 198, 369
title 387
top 389
window object 45, 401
writing to 407, 409
with statement 115, 140
described 127
write method 28, 46, 107, 407
example of use 30
using 30-32
writeln method 32, 46, 409