JavaScript Bible [5th ed]
9780764557439, 0764557432
* This new edition of the definitive guide to JavaScript has been revamped to cover the latest browsers, language update
272
80
7MB
English
Pages 1743
Year 2004
Report DMCA / Copyright
DOWNLOAD PDF FILE
Table of contents :
Cover......Page 1
Foreword......Page 10
Preface......Page 12
Contents at a Glance......Page 21
Contents......Page 24
Part I: Getting Started with JavaScript......Page 32
1: JavaScript's Role in the World Wide Web and Beyond......Page 34
Other Web Technologies......Page 35
JavaScript: A Language for All......Page 37
JavaScript: The Right Tool for the Right Job......Page 39
Leapfrog......Page 40
Duck and Cover......Page 41
Compatibility Issues Today......Page 42
Developing a Scripting Strategy......Page 45
The Software Tools......Page 48
Setting Up Your Authoring Environment......Page 49
What Your First Script Will Do......Page 51
Entering Your First Script......Page 52
Examining the Script......Page 53
Have Some Fun......Page 55
Part II: JavaScript Tutorial......Page 56
Scripts Run the Show......Page 58
JavaScript in Action......Page 59
The Document Object Model......Page 65
When a Document Loads......Page 67
Object References......Page 70
Node Terminology......Page 72
What Defines an Object?......Page 73
Exercises......Page 77
Where Scripts Go in Documents......Page 78
When Script Statements Execute......Page 82
Viewing Script Errors......Page 85
Scripting versus Programming......Page 86
Exercises......Page 87
Working with Information......Page 90
Variables......Page 91
Expressions and Evaluation......Page 93
Data Type Conversions......Page 95
Operators......Page 97
Exercises......Page 98
Decisions and Loops......Page 100
Control Structures......Page 101
About Repeat Loops......Page 102
Functions......Page 103
Arrays......Page 107
Exercises......Page 111
Top-Level Objects......Page 114
The window Object......Page 115
Window Properties and Methods......Page 118
The location Object......Page 120
The document Object......Page 121
Exercises......Page 126
The form Object......Page 128
Form Controls as Objects......Page 131
The Checkbox Object......Page 133
The Radio Object......Page 134
The select Object......Page 135
Passing Form Data and Elements to Functions......Page 137
Submitting and Prevalidating Forms......Page 139
Exercises......Page 141
String Objects......Page 142
The Math Object......Page 146
The Date Object......Page 147
Date Calculations......Page 148
Exercises......Page 150
Frames: Parents and Children......Page 152
References among Family Members......Page 154
About iframe Elements......Page 156
Controlling Multiple Frames-Navigation Bars......Page 157
References for Multiple Windows......Page 159
Exercises......Page 161
The Image Object......Page 162
Popular Dynamic HTML Techniques......Page 168
Exercises......Page 171
Part III: Document Objects Reference......Page 172
JavaScript Versions......Page 174
Embedding Scripts in HTML Documents......Page 175
Browser Version Detection......Page 179
Designing for Compatibility......Page 186
Language Essentials for Experienced Programmers......Page 189
Onward to Object Models......Page 192
The Object Model Hierarchy......Page 194
How Document Objects Are Born......Page 196
Object Properties......Page 197
Object Methods......Page 198
Object Event Handlers......Page 199
Object Model Smorgasbord......Page 200
Basic Object Model......Page 201
Navigator 4–Only Extensions......Page 202
Internet Explorer 4+ Extensions......Page 204
The W3C DOM......Page 208
Mixing Object Models......Page 223
Standards Compatibility Modes (DOCTYPE Switching)......Page 229
Where to Go from Here......Page 230
Generic Objects......Page 232
Frames......Page 390
window Object......Page 397
frame Element Object......Page 493
frameset Element Object......Page 499
iframe Element Object......Page 505
popup Object......Page 511
location Object......Page 516
history Object......Page 532
18: The Document and Body Objects......Page 540
document Object......Page 541
body Element Object......Page 607
TreeWalker Object......Page 617
19: Link and Anchor Objects......Page 622
Anchor, Link, and a Element Objects......Page 623
Image and img Element Objects......Page 632
area Element Object......Page 652
map Element Object......Page 655
The Form in the Object Hierarchy......Page 660
form Object......Page 661
fieldset and legend Element Objects......Page 677
label Element Object......Page 679
The button Element Object, and the Button, Submit, and Reset Input Objects......Page 682
checkbox Input Object......Page 687
radio Input Object......Page 694
image Input Object......Page 700
23: Text-Related Form Objects......Page 704
Text Input Object......Page 705
hidden Input Object......Page 720
textarea Element Object......Page 721
select Element Object......Page 726
option Element Object......Page 744
optgroup Element Object......Page 745
file Input Element Object......Page 748
Why "Events"?......Page 750
Event Propagation......Page 752
Referencing the event object......Page 771
event Object Compatibility......Page 772
Dueling Event Models......Page 773
Event Types......Page 776
NN4 event Object......Page 778
IE4+ event Object......Page 784
NN6+/Moz/Safari event Object......Page 804
26: Style Sheet and Style Objects......Page 824
Making Sense of the Object Names......Page 825
Reading Style Properties......Page 826
style Element Object......Page 827
styleSheet Object......Page 829
cssRule and rule Objects......Page 838
currentStyle , runtimeStyle , and style Objects......Page 841
filter Object......Page 868
Part IV: JavaScript Core Language Reference......Page 878
String and Number Data Types......Page 880
String Object......Page 882
String Utility Functions......Page 904
URL String Encoding and Decoding......Page 907
Numbers in JavaScript......Page 908
Math Object......Page 914
Number Object......Page 917
Boolean Object......Page 921
Time Zones and GMT......Page 922
The Date Object......Page 923
Validating Date Entries in Forms......Page 935
Structured Data......Page 940
Creating an Empty Array......Page 941
JavaScript Array Creation Enhancements......Page 942
Parallel Arrays......Page 943
Multidimensional Arrays......Page 946
Array Object Properties......Page 947
Array Object Methods......Page 949
If and If .Else Decisions......Page 962
Repeat (for) Loops......Page 967
The while Loop......Page 971
Looping through Properties (for-in)......Page 973
The with Statement......Page 974
Labeled Statements......Page 975
The switch Statement......Page 977
Exception Handling......Page 979
Using try-catch-finally Constructions......Page 981
Throwing Exceptions......Page 984
Error Object......Page 988
Operator Categories......Page 992
Comparison Operators......Page 993
Equality of Disparate Data Types......Page 994
Connubial Operators......Page 996
Assignment Operators......Page 998
Boolean Operators......Page 999
Bitwise Operators......Page 1003
Object Operators......Page 1004
Miscellaneous Operators......Page 1007
Operator Precedence......Page 1009
Function Object......Page 1012
Function Application Notes......Page 1019
Custom Objects......Page 1025
Object-Oriented Concepts......Page 1034
Object Object......Page 1037
34: Global Functions and Statements......Page 1040
Functions......Page 1041
Statements......Page 1047
blockquote and q Element Objects......Page 1054
br Element Object......Page 1055
font Element Object......Page 1056
h1...h6 Element Objects......Page 1059
hr Element Object......Page 1060
label Element Object......Page 1064
marquee Element Object......Page 1065
Methods......Page 1069
Range Object......Page 1070
selection Object......Page 1092
Text and TextNode Objects......Page 1099
TextRange Object......Page 1105
TextRectangle Object......Page 1132
Part V: Appendixes......Page 1136
Appendix A: JavaScript and Browser Object Quick Reference......Page 1138
Appendix B: JavaScript Reserved Words......Page 1152
Appendix C: Answers to Tutorial Exercises......Page 1154
Appendix D: JavaScript and DOM Internet Resources......Page 1170
Appendix E: What's on the CD-ROM......Page 1174
Index......Page 1652
End-User License Agreement......Page 1742