Index

Symbols

! operator 78
# (hash mark in URL) 180
% operator 74
& operator 76
&& operator 78
*/ comment 104, 106
-- operator 75
++ operator 75
/* comment 104, 106
// comment 19, 104, 106
^ operator 76
| operator 76
|| operator 78
~ operator 76

A

A HTML tag 50, 119
about: (URL syntax) 200
abs method 115
absolute value 115
acos method 115
ACTION attribute 116, 163
action property 116
alert method 28, 37, 116
alinkColor property 117
anchor method 118
anchor object 119
anchors
anchor object 119
defining 119
linking to 50
anchors array 119
anchors, creating 118
appCodeName property 122
appName property 122
appVersion property 123
arc cosine 115
arc sine 125
arc tangent 126
arguments array 84, 124
arithmetic operators
decrement 75
increment 74
modulus 74
unary negation 75
arrays
anchors 119
arguments 84, 124
associative 82
defined 53
defining 53
elements 39, 153
form 38
forms 164
frames 44, 45, 170
length of 190
links 194
options 240
populating 54
ASCII, string value 155, 273
asin method 125
assignment operators 72
defined 71
atan method 126

B

Back button 126
back method 126
background color 127
bgColor property 127
BIG HTML tag 128
big method 128
bitwise operators
logical 76
overview 75
shift 77
BLINK HTML tag 128
blink method 128
blur event 25, 210
blur method 129
BODY HTML tag 20
BOLD HTML tag 130
bold method 90, 130
Boolean literals 68
break statement 101, 106
browser
about: (URL syntax) 200
code name of 122
name of 122
navigator object 209
user agent 274
version of 123
browsers
hiding scripts from 19
button object 131
buttons
button object 131
clicking programmatically 138
defining 131
reset 232
submit 25, 30, 259

C

case sensitivity 19, 67, 81
ceil method 132
CGI programs
and image maps 60
and server JavaScript 16
submitting forms to 30
validating form input for 28
change event 25, 210
charAt method 133
checkbox object 133
checkboxes
checkbox object 133
checking programmatically 136
clicking programmatically 138
default selection state 145
defining 133
selection state 136
checked property 136
clear method 137
clearTimeout method 63, 138
click event 25, 210
click method 138
client JavaScript 15
close method 37
document object 139
window object 42, 140
colors
background 127
foreground 158
hexadecimal values 291
link 117, 197, 279
list of 291
string literals 291
string literals for 291-296
text 158
colors, font 160
commas
in cookies 55
comment statement 104, 106
comments 19, 106
types of 104
comparison operators 73
compute function 28
conditional expressions 72
conditional statements 97-98
confirm method 27, 37, 140
containership
specifying default object 103, 113
with statement and 103, 113
continue statement 101, 106
conventions 105
cookie property 141
cookies 141
defined 55
example of use 57
with JavaScript 56
limitations for 56
cos method 142
cosine 142

D

data types
converting 66
and Date object 65
in JavaScript 18, 65
Date object 144
creating 92
overview 92
using 61-63
dates
converting to string 271
cookie expiration 55
Date object 144
day of month 173
day of week 174
defining 144
GMT conversion 270
milliseconds since 1970 219, 275
month 175
working with 92
year 177, 252
decrement operator 75
default objects, specifying 103, 113
defaultChecked property 145
defaultSelected property 146
defaultStatus property 60, 147
defaultValue property 148
dialog boxes
Alert 37, 116
Confirm 27, 37, 140
Prompt 38, 226
directories, conventions used 12
document conventions 12-13
document object 33, 149
anchors array 119
described 38
example of properties 33-35
forms array 164
links array 194
documents
anchors array 119
anchors in 119
clearing 137
closing 139
color of 127, 158
current URL 274
defining 149
displaying HTML output in 149
document object 38, 149
forms array 164
last modified date 190
links array 194
onUnload event handler 212, 214
opening 214
title 270
writing to 285, 286

E

E property 153
elements array 39, 153
encoding property 154
ENCTYPE attribute 154, 164
escape function 55, 57, 155
escaping characters 69
Euler's constant 153
base 10 logarithm of 202
base 2 logarithm of 202
raised to a power 157
eval function 28, 66, 155
overview 94
event handlers 210-214
defining 25
defining functions for 26
example of use 27-28
onBlur 210
onChange 210
onClick 210
onFocus 211
onLoad 212
onMouseOver 212
onSelect 213
onSubmit 213
onUnload 214
quotation marks for 26
referring to windows 48
scripting 25-28
specifying object names in 140
syntax for 26
events, defined 25
exp method 157
expressions
conditional 72
overview 71
types of 71

F

fgColor property 158
file: (URL syntax) 200
fixed method 158
floating-point literals 68
floor method 159
focus
focus event 211
giving 159
onBlur event handler 210
onChange event handler 210
onFocus event handler 211
removing 129
focus event 25
focus method 159
fontcolor method 160
fonts
big 128
blinking 128
bold 130
color of 160
fixed 158
italic 188
size of 162
small 253
strikeout 255
subscript 258
superscript 262
FONTSIZE HTML tag 162
fontsize method 162
for loops
continuation of 101, 106
sequence of execution 98
syntax of 107
termination of 101, 106
for statement 98-99, 107
for...in statement 102, 108
foreground color 158
form elements
updating 24
updating dynamically 37
FORM HTML tag 33, 50, 163
form object 163
described 38
elements array 39, 153
form submit
referring to windows 50
forms
ACTION attribute 116, 163
buttons 131
checkboxes 133
defining 163
destination URL 116
element focus 129, 159
element names 207
elements array 39, 153
ENCTYPE attribute 154, 164
form object 38, 163
forms array 38, 164
hidden object 180
METHOD attribute 163, 206
MIME encoding 154, 164
number of elements 190
onSubmit event handler 213
password objects 222
radio buttons 228
reset buttons 232
resetting values 232
selection lists 238
submit buttons 259
submitting 258, 259
TARGET attribute 163
target property 263
text objects 264
textarea objects 267
validating input 28
forms array 38, 164
Forward button 168
forward method 168
FRAME HTML tag 37, 50
frame names
linking to 50
frame object 169
described 37
frames array 170
frames
closing 42
creating 43
defined 43
defining 169
example of creation 46-47
figure of 43
frame object 37, 169
frames array 44, 45, 170
hierarchy of 44
navigating 46
parent 218
referring to 46, 48-50
top 272
updating 45
frames array 44, 45, 170
FRAMESET HTML tag 43, 169
ftp: (URL syntax) 200
function keyword 21, 82
function statement 108
functions 115-287
arguments array 124
calling 21-22
defined 21
defining 21-22
defining and calling 82-84
escape 155
eval 94, 155
examples of 28
excess arguments for 84
isNAN 187
number of arguments 190
parseFloat 96, 219
parseInt 96, 220
recursive 83
return values of 111
unescape 273
using built in 94-96
using validation 29-30

G

getDate method 173
getDay method 93, 174
getHours method 62, 174
getMinutes method 62, 175
getMonth method 175
getSeconds method 62, 176
getTime method 93, 176
getTimezoneOffset method 177
getYear method 177
Go menu 178, 182
go method 39, 178
gopher: (URL syntax) 200

H

hash property 180
HEAD HTML tag 20, 83
hidden object 180
history list 39
loading URL from 178
next URL in 168
previous URL in 126
History menu option 178
history object 33, 182
described 39
number of entries 190
host property 183
hostname property 184
HREF attribute 59
href property 184
HTML
embedding JavaScript in 19-20
and JavaScript 11
HTML layout 36-37
HTML tags
A 50, 119
BIG 128
BLINK 128
BODY 20
BOLD 130
FONTSIZE 162
FORM 33, 50, 163
FRAME 37, 50
FRAMESET 43, 169
HEAD 20, 83
I 188
IMG 59
INPUT 131, 133, 180, 222, 228, 232, 259, 264
MAP 59
PRE 24
SCRIPT 19, 20
SELECT 238
SMALL 253
STRIKE 255
SUB 258
SUP 262
TEXTAREA 267
TITLE 34
TT 158
http: (URL syntax) 200
HyperText Markup Language See HTML

I

I HTML tag 188
if...else statement 97, 109
image maps
client-side 59
server-side 59
IMG HTML tag 59
increment operator 74
index property 186
indexOf method 186
INPUT HTML tag 131, 133, 180, 222, 228, 232, 259, 264
integers
in JavaScript 68
ISMAP attribute 59
isNaN function 187
italics method 188

J

Java
compared to JavaScript 18
JavaScript
background for using 11
compared to Java 18
described 17
embedding in HTML 19-20
and HTML layout 36-37
LiveWire 16-17
Navigator 15-16
reserved words 289
special characters 69
types of 15
JavaScript URLs 58
javascript: (URL syntax) 200

K

keywords 289

L

LANGUAGE attribute 19
language, specifying 19
lastIndexOf method 189
lastModified property 190
layout, HTML 36-37
left shift operator 77
length property 89, 190
link method 90, 192
link object 193
linkColor property 197
links
anchors for 118, 119
color of 117, 197, 279
creating 50
defining 192, 193
image maps 59
link object 193
links array 194
referring to windows 50
target 263
links array 194
lists, selection 238
literals
Boolean 68
floating point 68
integers 68
overview 67
string 68
LiveWire applications
validating form input for 28
LiveWire JavaScript See server JavaScript
LN10 property 198
LN2 property 197
load event 25, 212
location object 33, 198
described 39
location property 45, 274
log method 201
LOG10E property 202
LOG2E property 202
logarithms
base 10 of e 202
base 2 of e 202
base of natural 153, 157
natural logarithm of 10 198
natural logarithm of 2 197
natural logarithm of a number 201
logical operators
overview 78
short-circuit evaluation 78
loop statements
for 98-99
while 100
loops
continuation of 101, 106
for 107
for...in 102, 108
termination of 101, 106
while 112
lowercase 19, 67, 271

M

mailto: (URL syntax) 200
MAP HTML tag 59
Math object 204
overview 91
mathematical constants and functions 204
max method 205
messages
Alert dialog box 37, 116
Confirm dialog box 37, 140
Prompt dialog box 38, 226
status bar 60
METHOD attribute 35, 163, 206
method property 206
methods 115-287
defined 22
defining 87
referring to windows 48
MIME encoding 154
min method 206
modulo function 74
modulus operator 74
mouseOver event 212
mouseover event 25

N

NAME attribute 35
name property 207
natural logarithms
base of 153
e 153
e raised to a power 157
of 10 198
of 2 197
of a number 201
Navigator
about: (URL syntax) 200
code name of 122
name of 122
navigator object 209
user agent 274
version of 123
Navigator 2.0
and arrays 53
and JavaScript 15, 16
printing script 24
Navigator JavaScript See client JavaScript
navigator object 33, 209
new operator 54, 85, 109
described 103
news: (URL syntax) 200
null keyword 72
numbers
absolute value of 115
arc cosine of 115
arc sine of 125
arc tangent of 126
cosine of 142
evaluating 94
exponents of 225
greater of two 205
isNAN 187
lesser of two 206
natural logarithm of 201
obtaining integer 132, 159
parsing from strings 96, 219, 220
random 231
rounding 234
sine of 252
square root 253, 254
tangent of 263

O

object manipulation statements
for...in 102
new operator 103
this operator 103
with statement 103
objects 115-287
adding properties 86
creating new types 85-87, 109
establishing default 103, 113
focus 129, 159
hierarchy of 31
overview 81
specifying names in event handlers 140
onBlur event handler 25, 210
onChange event handler 25, 28, 29, 210
onClick event handler 25, 28, 29, 58, 210
onFocus event handler 25, 211
onLoad event handler 25, 62, 212
onMouseOver event handler 25, 61, 212
onSelect event handler 25, 213
onSubmit event handler 25, 30, 213
onUnload event handler 25, 214
open method 37
document object 214
window object 41, 216
operators
arithmetic 74-75
assignment 72
bitwise 75-77
comparison 73
defined 71
logical 78
order of 79
overview 74
string 78
options array 240
output
displaying 24
printing 24
output stream
closing 139
opening 214

P

pages
objects for 33
updating 24
parent property 48, 218
parse method 94, 219
parseFloat function 66, 219
overview 96
parseInt function 66, 220
overview 96
password object 222
default value 148
pathname property 224
PI property 91, 224
port property 225
pow method 225
PRE HTML tag 24
printing 24
prompt method 38, 226
properties 115-287
naming 35
overview 81
referring to 33
referring to windows 48
protocol property 226

Q

quotation marks
for string literals 68
using double 26
using single 26

R

radio buttons
clicking programmatically 138
default selection state 145
defining 228
number of buttons 190
radio object 228
selecting programmatically 136
selection state 136
radio object 228
number of buttons 190
random method 231
referrer property 231
reflection 36-37
reserved words 289
reset buttons
clicking programmatically 138
defining 232
reset object 232
reset object 232
return statement 22, 111
RGB color values 291
right shift operators 77
round method 234

S

SCRIPT HTML tag 19, 20
scripts
example of 20
hiding 19
search property 236
select event 25, 213
SELECT HTML tag 238
select method 237
select object 238
options array 240
selected property 244
selectedIndex property 245
selection lists
default selection state 146
defining 238
number of options 190
option index 186
option text 266
options array 240
select object 238
selection state 244
self property 48, 246
semicolons
for event handlers 26
in cookies 55
in JavaScript 20
server JavaScript 16
setDate method 247
setDay method 93
setHours method 248
setMinutes method 248
setMonth method 248
setSeconds method 249
setTime method 93, 94, 249
setTimeOut method 38
setTimeout method 63, 250
setYear method 252
sin method 252
sine 252
SMALL HTML tag 253
small method 253
space characters
in cookies 55
SQL 17
sqrt method 253
SQRT1_2 property 254
SQRT2 property 254
square roots 253
of 1/2 254
of 2 254
statements 105-114
break 101
conditional 97-98
continue 101
for...in 102
loop 98-102
object manipulation 102-104
overview 97-104
syntax conventions 105
status bar
default message 147
displaying hints 61
displaying messages 38, 60
setting message 255
status property 38, 60, 255
STRIKE HTML tag 255
strike method 255
string literals 68
string object 256
overview 89
string operators 78
strings
ASCII value of 155, 273
blinking 128
bold 130
character position within 133, 186, 189
color of 160
converting from date 271
converting to binary 220
converting to floating point 219
defining 256
evaluating 155
fixed font 158
fontsize of 128, 162, 253
italic 188
length of 190
lowercase 271
strikeout 255
string object 256
subscript 258
subset of 261
superscript 262
uppercase 273
Structured Query Language 17
SUB HTML tag 258
sub method 258
submit buttons
clicking programmatically 138
defining 259
event handlers for 25
submit object 259
submit event 25, 213
submit method 30, 258
submit object 259
subscripts 258
substring method 90, 261
subwindows
updating 24
SUP HTML tag 262
sup method 262
superscripts 262
syntax conventions 105

T

tan method 263
tangent 263
TARGET attribute 50, 163
target property 263
text color 158
text object 264
default value 148
defining 264
text property 266
TEXTAREA HTML tag 267
textarea object 267
default value 148
defining 267
event handlers for 25
this keyword 26, 30, 85, 87, 111
for object references 88
this operator
described 103
time zones 177
timeouts
canceling 138
setting 250
times
Date object 144
defining 144
hours 174
minutes 175
numeric value 176
seconds 176
time zone offset 177
working with 92
TITLE HTML tag 34
title property 270
toGMTString method 55, 270
toLocaleString method 271
toLowerCase method 271
top property 48, 272
toUpperCase method 90, 273
trigonometric methods
acos 115
asin 125
atan 126
cos 142
sin 252
tan 263
TT HTML tag 158
typographical conventions, used in this book 13

U

unary negation 75
unescape function 55, 57, 273
unload event 25, 214
uppercase 19, 67, 273
URLs
anchor name in 180
calling document's 231
conventions used 12
current 198, 274
domain 184
entire URL string 184
examples of common 200
form destination 116
form field input 163
history list 182
host 184
hostname:port 183
IP address 184
javascript: 58
loading from history list 178
next 168
port 225
previous 126
protocol 226
query information 236
syntax of 199, 200
url-path 224
user interaction
Alert dialog box 116
buttons 131
checkboxes 133
Confirm dialog box 140
Prompt dialog box 226
radio buttons 228
reset buttons 232
selection lists 238
submit buttons 259
text objects 264
textarea objects 267
userAgent property 274
UTC method 275

V

value property 275
values See data types
var keyword 67
var statement 112
variables
declaring 67, 112
initializing 112
in JavaScript 67
naming 67
scope of 67
syntax for declaring 112
vlinkColor property 279

W

while loops
continuation of 101, 106
syntax of 112
termination of 101, 106
while statement 100, 112
window object 33, 280
described 37
frames array 170
methods of 37
window property 284
windows
clearing 137
closing 42, 140
default status message 147
defining 216, 280
displaying HTML output in 149
frames 169
frames array 170
giving focus to 51
name of 207
naming 42, 48
navigating among 51
number of frames 190
onLoad event handler 212
onUnload event handler 214
opening 41, 216
overview 41
referring to 48-50
status bar 147, 255
title 270
top 272
window object 37, 280
writing to 285, 286
with statement 91, 113
described 103
write method 20, 38, 83, 285
example of use 22
using 22-24
writeln method 24, 38, 286