Tải bản đầy đủ (.pdf) (10 trang)

JavaScript Bible, Gold Edition part 215 potx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (63.41 KB, 10 trang )

1480
Index ✦ C–D
createTFoot( ) method, TABLE element
object, 640
createTHead( ) method, TABLE element
object, 640
crypto property, 232
CSS (cascading style sheets), 74, 116
cursor attribute, 282–283
table of contents, 1336–1343
CSS1 (Cascading Style Sheets Level 1), 16
cssRule object, 792–796
cssRules property, styleSheet object, 783
cssText property, styleSheet object,
783–784
ctrlKey property
event object (IE4), 747–748
event object (NN6+), 764–765
ctrlLeft property, event object (IE4),
748–749
curly braces, CD-54–CD-55
current property, history object, 333–334
currentStyle object, 796–840
font properties, 801–812
property values, 798–801
style properties, 797–798
text properties, 801–812
currentStyle property, 118
currentTarget property, event object
(NN6+), 770
cursor style sheet attribute, 282–283


cursor types, 282–283
custom objects
arrays of, creating, 1113–1114
creating, 1116
methods, custom, 1115–1116
D
data, CD-35
data binding, 120–121
data entry validation, CD-7
data property
event object (NN4), 742
Text object, 446
TextNode object, 446
data types, 58, CD-36
comparison operators, 1072–1073
conversion, CD-40–CD-42
converting, 1193
converting, applets, 1189–1190
strings, 927–930
databases, 1300
dataFld property, 119–120
dataFormatAs property, 119–120
dataPageSize property, TABLE element
object, 634–635
dataSrc property, 119–120
dataTransfer property, event object (IE4),
754–757
date entries, forms, 983–986
Date object, 969–986, CD-94–CD-96
calculations, CD-96–CD-97

creating, 969–971
formatting, 976–977
mathematical calculations with, 978–979
methods, 971–975, CD-95
millisecond dates, creating, 974
properties, 971
string format, 975–976
time zones, 975
DD element object, 662–663
debugging scripts
browser crashes, 1235
comments, statements and, 1229
embeddable Evaluator and, 1230–1231
error messages, 1218–1219
HTML tags, 1226–1227
prevention, 1235–1236
reopening files, 1228–1229
runtime errors, 1217–1218
runtime expression evaluation,
1229–1230
source, viewing, 1227
syntax errors, 1217–1218
tables, 1228
timing, 1228
trace utility, 1232–1234
working intermittently, 1227–1228
1481
Index ✦ D
decimal numbers, converting to
hexadecimal, 954–955

Decision Helper, CD-6–CD-6
navigation bars and, CD-104–CD-105
decision helper application, 1375–1398
decisions, CD-47–CD-48
declaring variables, CD-37
decodeURI( ) function, 1128–1129
decodeURIComponent( ) function,
1128–1129
decrementing arrays, 130–131
defaultCharset property, document object,
358
defaultChecked property
Checkbox Input object, 558–559
Radio Input object, 562
defaultStatus property, 344
defaultValue property, Text Input object,
574
deferred scripting, CD-28–CD-30
dynamic tables and, 1286
deleteCaption( ) method, TABLE element
object, 639–340
deleteCell( ) method, TR element property,
651–652
deleteContents( ) method, Range object,
435–436
deleteData( ) method
Text object, 447–448
TextNode object, 447–448
deleteRow( ) method, TABLE element
object, 640–641

deleteRule( ) method, styleSheet object,
792
deleteTFoot( ) method, TABLE element
object, 640
deleteTHead( ) method, TABLE element
object, 640
delimiter characters, HTML tags, 4
demo( ) function, CD-54
description property
Error object, 1064–1065
mimeType object, 685
plugin object, 689–690
designMode property, document object, 359
detach( ) method, Range object, 436–437
detachEvent( ) method, 155–156
detail property, event object (NN6+), 770
DHTML. See Dynamic HTML
dialog boxes, 289–290
cautions, 290–291
features, 289–290
retrieving data, 288–289
dialogArguments property, 233
dialogHeight property, 233
dialogLeft property, 234
dialogTop property, 234
dialogWidth property, 233
Dictionary object, 1141–1142
digital certificates, 1246–1247
dimmed elements, 121
DIR element object, 663

dir property, 121
direction property, MARQUEE element
object, 421–422
directories property, 234–236
disabled property, 121–122, 128
Link element object, 481
styleSheet object, 784–785
disableExternalCapture( ) method, 261–262
dispatch lookup table, validation and,
1162–1164
dispatchEvent( ) method, 163
DIV element, 75
DL element object, 662–663
doctype property, document object,
359–360
document object, 13, CD-10, CD-61,
CD-69–CD-72
arrays, CD-58–CD-59
browsers, 63–64
defining, 64
event handlers, 398–399
methods, 378–398
properties, 344–378
1482
Index ✦ D–E
document property, 122, 236
FRAME element object, 301
IFRAME element object, 313
layers, 864
popup object, 317–318

document.all array, 71
documentation, online, 1467
document.close( ) method, CD-71
documentElement property, document
object, 360
document.forms[ ] property, CD-70
document.images array, 51–52, CD-112
document.layers property, 70–71
documents
loading, CD-10–CD-14
references to, CD-15
document.title property, CD-70
document.write( ) method, CD-39, CD-
70–CD-72
window object, 227
doIt( ) function, 51
DOM (document object model), 15, CD-8
compatibility, 20
content replacing/adding, 89
Core DOM, 76–77
event handling, 99
levels, 77
positioned elements, 874–899
proprietary, CD-10
standard, CD-10
W3C, 76–92
domain property, document object,
360–361
doReadRequest( ) method, userProfile
object, 708–709

doScroll( ) method, BODY element object,
406–407
dot syntax, 62, CD-17–CD-18
downloading plug-ins, 6
dragging, element dragging behavior,
1277–1280
dragging layers, 894–899
DreamWeaver, 19
DT element object, 662–663
DTD (Document Type Definition), 81
dummy functions, 50
duplicate( ) method, TextRange object,
456–457
dynamic content, DOM, 96–97
Dynamic HTML, 16, CD-6–CD-7,
CD-115–CD-116
API example, 1269–1272
behaviors, 76
compatibility issues, 1261–1268
element positioning, 209
interactivity, CD-8
map puzzle application, 1399–1414
non-DHTML browsers, 1268–1269
overview, 1259–1261
tables, 1293–1297
W3C DOM and, 78–79
dynamic styles, 94–95
dynamic tables, 1289–1293
dynsrc property, Image element object, 511
E

ECMA (European Computer Manufacturer’s
Association), 14–15, CD-35
ECMAScript, 38
element positioning, 97–98
element referencing, W3C COM, 79–80
elementFromPoint( ) method, document
object, 385–386
elements
attributes, removing, 158–159
containment hierarchy, 73–74
functions, passing to, CD-83–CD-85
grouping, 105
long descriptions, 303
sibling elements, 132
elements property, FORM element object,
538–539
EMBED element object, 913–916
properties, 914–916
<EMBED> tag, 1198, 1199
embeddable Evaluator, debugging scripts
and, 1230–1231
1483
Index ✦ E
embedding
behavior components, 1274–1275
scripts, HTML documents, 38–44
sound, multiple, 1209–1214
embeds property, document object, 361
empty( ) method, selection object, 444–445
enabledPlugin property, mimeType object,

685–686
enableExternalCapture( ) method, 261–262
encodeURI( ) function, 1128–1129
encodeURIComponent( ) function,
1128–1129
encoding property, FORM element object,
539–540
enctype property, FORM element object,
539–540
endContainer property, Range object, 430
endOffset property, Range object, 430–431
entities, 43–44
Enumerator object, 1142–1143
error messages, 1218–1219
multiple, 1219
text, 1221–1226
Error object, 1063–1067
methods, 1067
properties, 1064–1067
error trapping, 60
errors
file names, 1219
location, 1220–1221
runtime versus syntax, 1217–1218
scripts, 244
scripts, viewing, CD-30–CD-32
escape( ) function, 1129–1130
eval( ) function, 111, 1130–1132, CD-112
evaluated text, 27
Evaluator Jr. (Navigator), CD-40

Evaluator Sr. (Navigator), 54–56
evaluator.html file, 56
EVENT attribute, 40
event binding, scripts, 75
event bubbling, 74–75
event capture model, Navigator 4, 70
event handlers, 66–68, CD-20–CD-21
assignments, 51
behavior components, 1276
BODY element object, 407
BUTTON element object, 554–555
calling functions from, CD-52
Checkbox Input object, 559
document object, 398–399
FORM object, 544–545
generic objects, 191–216
Image element object, 519–520
keyboard events, 208–210
layers, 873–874
Link element object, 484
MARQUEE element object, 424–425
as methods, 66–67
as object properties, 50–51
as properties, 67–68
Radio Input object, 564–565
SELECT element object, 606–607
Text Input object, 580–582
window object, 292–299
event listener, 91
event models, bidirectional, 90–91

event object
compatibility, 734–735
referencing, 732–733
event object (IE4) properties, 745–762,
747–762
event object (NN4), 741–745
properties, 742–745
event object (NN6+), 762–775
methods, 774–775
properties, 764–774, 764–775
event objects
overview, 711–712
static, 713
event property, 236–237
SCRIPT element object, 488–489
event tasks, keyboard, 208–210
eventPhase property, event object (NN6+),
771
1484
Index ✦ E–F
events, CD-20–CD-21
capturing, 279–280
models, 735–738
onChange, CD-78
passing, 718–720
propagation, 713–732
redirecting, Internet Explorer, 720–723
targets, drag and drop and, 201–202
types, 738–741
exception handling, 1053

exceptions compared to errors,
1053–1055
throwing error object exceptions,
1060–1061
throwing exceptions, 1059–1063
throwing object exceptions, 1062–1063
throwing string exceptions, 1059–1060
try-catch-finally constructions,
1055–1058
exec( ) method, regular expression object,
1026–1027
execCommand( ) method
document object, 386–388
TextRange object, 457–460
execScript( ) method, 262
executing statements
deferred, CD-28–CD-30
immediate, CD-28
user actions, CD-30
execution flow, control structures and,
CD-48
expand( ) method, TextRange object,
460–461
expando property, document object, 361
expiration dates, cookies, 351–352
expressions
evaluation, CD-38–CD-40
operators, CD-43
script1.htm, CD-39
variables and, CD-39

extensions
Internet Explorer 5+, 75–76
Navigator 4, 69–71
external property, 237–238
extractContents( ) method, Range object,
436–437
extracting
string characters, CD-92–CD-93
substrings, CD-92–CD-93
extranets, 44
F
face property
BASEFONT element object, 478
FONT element objects, 413
FAQs, 1466
fgColor property, document object,
344–345, 362
fields, 1181
FIELDSET element object, 545–546
File Input element object, 610–611
file names, errors, 1219
fileCreatedDate property
document object, 362
Image element object, 512
fileModifiedDate property
document object, 362
Image element object, 512
fileName property
Error object, 1065
plugin object, 689–690

fileSize property
document object, 362
Image element object, 512
FileSystemObject object, 1143
filter object, 840–851
filters
functions, library building, 1152–1156
links and, 49
static, 841–842
transition filters, 843–845
validation and, 1151
filters property, 122
find( ) method, 263
findText( ) method, TextRange object,
461–462
fireEvent( ) method, 164–165
firstChild property, 123
1485
Index ✦ F
firstPage( ) method, TABLE element object,
641
Flash, 6
floating-point numbers, 952–954,
CD-41–CD-42
exponents, 954
focus
hiding, 125
onBlur event handler, 194–195
focus( ) method, 67, 156–158
Text Input object, 578–579

FONT element object, 411–414
properties, 412–414
font properties
currentStyle object, 802–804
style object, 802–804
fontSmoothingEnabled property, screen
object, 703
FOR attribute, 40
for loops, CD-49, CD-50
childNodes array and, 115
length property and, 130–131
form controls, CD-76
elements, CD-11
objects, CD-77–CD-79
form data, passing to functions,
CD-83–CD-85
FORM object, 528–545, CD-11, CD-75–CD-77
arrays, 536
defining, 528–529
event handlers, 544–545
methods, 542–544
properties, 537–542
form property
BUTTON element object, 552
LABEL element object, 419
Text Input object, 574
<FORM> tag, CD-11, CD-12, CD-76
formatting
Date object, 976–977
numbers, 953–954

strings, 929–930
form.elements[ ] property, CD-76–CD-77
forms, CD-12. See also order forms
adding, CD-15–CD-16
blur( ) method and, 157–158
CGI and, 5
date entries, 983–986
date entry validation, 1158–1160
focus( ) method and, 157–158
layers and, 859–860
prevalidating, CD-85–CD-87
properties, access, CD-76
submitting, CD-85–CD-87
validation, CD-4
forms property, document object, 363–364
forward( ) method
history, 335–336
window object, 256, 263
FRAME element, 224–225
FRAME element object, 299–305
properties, 300–305
syntax, 299
frame object model, 218–220
frame property, TABLE element object,
635–636
<FRAME> tag, 219–220, CD-101–CD-102
FRAMEBORDER attribute, 300
frameBorder property
FRAME element object, 302
FRAMESET element object, 309

IFRAME element object, 313
frameElement property, 238
frames
blank, 223–224
border color, 300
border thickness, 307
borders, 302
children, CD-99–CD-101
creating, 218
ensuring framing, 221–222
FRAME element objects and, 224–225
hierarchy, CD-100
multiple, CD-5–CD-6, CD-103–CD-105
parents, CD-99–CD-101
preventing framing, 221
referencing, 220
Continued
1486
Index ✦ F–G
frames (continued)
resizing, 303–304
scripting tips, CD-103
sizing, 303–304
source code, viewing, 224
spacing, 309
switching from, 222
synchronization, 223
frames property
document object, 364–365
window object, 239–240

FRAMESET element object, 305–309
properties, 307–309
<FRAMESET> tag, 219–220
framesets, CD-100
loading, forcing, 221–222
parent documents, CD-100
spacing, 309
frameSpacing property
FRAMESET element object, 309
IFRAME element object, 314
fromElement property, event object (IE4),
757
front end, CD-3
FrontPage, 19
fullName( ) function, CD-81
fullScreen( ) function, 66
Function object, 1093–1102
functions, creating, 1094–1095
methods, 1100–1102
nesting, 1095–1096
parameters, 1096–1097
properties, 1097–1100
function references, 155
functions, CD-36, CD-51–CD-54
calling from event handler, CD-52
constructor, Image object,
CD-110–CD-111
dummy functions, 50
elements, passing to, CD-83–CD-85
filter functions, 1152–1156

form data, passing to, CD-83–CD-85
global, 1128–1136
invoking, 1102–1103, CD-29
libraries, 1107–1108
names, CD-51
overloading, 59
parameters, CD-51–52
parameters, passing, 286–287
recursion, 1107
validation, combining, 1156–1158
values, returning, 59
G
generic objects
event handlers, 192–216
methods, 150–191
properties, 109–150
getAdjacentText( ) method, 165–166
GetAttention( ) method, 264
getAttribute( ) method, 166–167
userProfile object, 709
getAttributeNode( ) method, 167–169
getBookmark( ) method, TextRange object,
462–463
getBoundingClientRect( ) method, 169
getClientRects( ) method, 169–170
getElementByID( ) method, document
object, 388–389
getElementsByName( ) method, document
object, 389
getElementsByTagName( ) method,

170–171
getExpression( ) method, 171
getIEVersion( ) function, 95
getSelection( ) method, document object,
390
getters, object property, 1118–1119
global functions, 1128–1136
global property, regular expression object,
1024
global statements, 1137–1146
global variables, 1103–1106, CD-53
example, CD-53–CD-54
host environment and, 58
go( ) method, history object, 336–337
goNext( ) function, CD-105
graphics application, 1355–1357
Greenwich Mean Time (GMT), 967–969,
CD-94
1487
Index ✦ H
H
handleEvent( ) method
document object, 390
FORM element object, 542
FORM object, 542
window object, 264–265
hasChildNodes( ) method, 171–172
hash property
A element object, 499
Anchor element object, 499

AREA element object, 523–524
Link element object, 499
location object, 324
head, scripts in, CD-25
HEAD element object, 474–475
headers property
TD element object, 654
TH element object, 654
HEIGHT attribute, 124, CD-110
height property, 124
APPLET element object, 905
document object, 365
EMBED element object, 915
FRAME element object, 302
Image element object, 513
MARQUEE element object, 422
OBJECT element object, 911
screen object, 699–700
TABLE element object, 636
TD element object, 655–656
TH element object, 655–656
TR element object, 650–651
helpers, 6
H1 H6 element objects, 414–415
Hidden Input object, 582–583
hidden property, EMBED element object,
915
hide( ) method, 318–319
hideFocus property, 125
hiding scripts, CD-27

hierarchy
containment, 73–74
frames, CD-100
objects, CD-10–CD-11
hijacking, cookies, 350
History object, CD-69
methods, 335–337
properties, 333–334
history property, 240
home( ) method, 265
host environment, 57
global scope and, 58
host property
A element object, 499
Anchor element object, 499
AREA element object, 523–524
Link element object, 499
location object, 325
hostname property
A element object, 499
Anchor element object, 499
AREA element object, 523–524
Link element object, 499
location object, 325
HR element object, 415–418
href property
A element object, 499
Anchor element object, 499
AREA element object, 523–524
BASE element object, 476

Link element object, 481–482, 499
location object, 326–327
styleSheet object, 785
hrefLang property
A element object, 500
Anchor element object, 500
Link element object, 482, 500
hspace property
APPLET element object, 905–906
IFRAME element object, 314
Image element object, 513
MARQUEE element object, 422
OBJECT element object, 911–912
HTAs (HTML applications), 76
htc extension, 76
HTML applications, 76
HTML collections, 176
HTML element object, 473–474
1488
Index ✦ H–I
HTML (Hypertext Markup Language), 4–5
debugging tags, 1226–1227
delimiter characters in tags, 4
documents, called by applets,
1196–1197
editable content, 118
element objects, 71–73
forms and, 1313–1319
loading to layers, 889–890
tags, 4–5

htmlFor property
LABEL element object, 419, 548
SCRIPT element object, 488–489
htmlText property, TextRange object,
453–454
hybrid tables (dynamic/static), 1293
HyperCard, 7
I
ID attribute, 125, CD-15
signing scripts, 1249–1250
id property, 125
styleSheet object, 785
identifiers (objects), CD-15
id property, 125
ids property, document object, 366
IE/Windows objects, plug-in detection,
695–698
if constructions, CD-48–CD-49
if else constructions, CD-49
IFRAME element object, 310–316
properties, 311–316
ignoreCase property, regular expression
object, 1024
Image element object, 505–520
event handlers, 519–520
properties, 509–519
Image Input object, 565–567
properties, 566–567
Image object, 69, CD-109–CD-115
constructor function, CD-110–CD-112

property values, 124
image rollovers, CD-112–CD-115
image swapping, 51–52
imageOff( ) function, CD-113
imageOn( ) function, CD-113
images
basic object model and, 69
interchangeable, CD-110
precaching, CD-110–CD-112
src property, CD-110
images property, document object,
366–367
<IMG> tag, CD-109
immediate scripting, dynamic tables and,
1286
immediate statements, CD-28
implementation property, document
object, 367–368
importing style sheets, 779–780
imports property, styleSheet object,
785–786
indexes, CD-55
branching pages, 47–49
inheritance
containment comparison, 222–223
hierarchy, 65
prototype-based, 59
prototypes, 1121–1123
initial expression, loops, CD-50
initializing

arrays, 988
variables, CD-37
inline branching, browser compatibility,
1262–1263
inline display properties, styles, 812–821
innerHeight property, 240–241
innerHTML property, 72, 126–127
innerText property, 72, 126–127
innerWidth property, 240–241
input, text input elements, CD-12–CD-13,
CD-16
Input object, this keyword and, CD-84
input property, RegExp object, 1028–1029
inRange( ) method, TextRange object, 463
insertAdjacentElement( ) method, 123,
172–173
insertAdjacentHTML( ) method, 173–175
1489
Index ✦ I–K
insertAdjacentText( ) method, 173–175
insertBefore( ) method, 86, 175
insertCell( ) method, TR element property,
651–652
insertData( ) method
Text object, 447–448
TextNode object, 447–448
insertNode( ) method, Range object, 437
insertRow( ) method
TABLE element object, 640–641
tables, 621–625

insertRule( ) method, styleSheet object, 792
installation, plug-ins, 694–695
integer numbers, 952–954
hexadecimal, 954–955
octal, 954–955
integers, CD-41
intelligent updated flags application,
1365–1373
interactive data, CD-5
interactivity, CD-2
interCap format, naming, CD-38
functions, CD-51
international characters, signed scripts,
1258
Internet Explorer
event bubbling, 74–75
event object, 745–762
event object references, 732
extensions, 71–76
HTML element features in common, 72
JavaScript versions, 37–38
objects, 1140
open( ) method, 274
printing, 276
selection object, 442
sticky cursor, 381
syntax, NN6 and, 99–102
versions, 55
invoking functions, 1102–1103, CD-29
invoking methods, CD-19

isChar property, event object (NN6+), 771
isContentEditable property, 127
isDisabled property, 127–128
isEmpty( ) function, 1152–1153
isEqual( ) method, TextRange object,
463–464
isFinite( ) function, 1132
ISINDEX element object, 478–479
isInteger( ) function, 1154
isMap property, Image element object, 514
isMultiLine property, 128
isNaN( ) function, 1132–1133
isNumber( ) function, 1155
isOpen property, 318
isPosInteger( ) function, 1153–1154
isTextEdit property, 128–129
isValidFragment( ) method, Range object,
437–438
item( ) method, 111, 175–176
SELECT input object, 606
J
Java applets, 7
JavaScript, 7–10
enabling, 44–46
JScript comparison, 40
reasons to use, 9–10
VBScript comparison, 40
versions, 37–38
when to use, CD-7–CD-8
joining strings, CD-90–CD-91

js files, 42–43
JScript, 9, 14–15, CD-35
JavaScript comparison, 40
JSObject class, 1191–1193
jukebox example, 1206–1209
K
key codes/character codes comparison,
208
keyboard
accessKey property, 109–110
event tasks, 208–210
keyCode property, event object
IE4, 757–758
NN6+, 767–768
keywords, reserved, 1447, CD-37

×