Professional JavaScript for Web developers 9780764579080, 0764579088

Прекрасная книга по современному JavaScript. В этой книге объясняется как программировать на JavaScript с использованием

346 68 3MB

English Pages 674 Year 2005

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Cover......Page 1
Contents......Page 11
Introduction......Page 23
A Short History......Page 29
ECMAScript......Page 31
The Document Object Model (DOM)......Page 34
Summary......Page 37
Syntax......Page 39
Variables......Page 40
Primitive and Reference Values......Page 43
The typeof operator......Page 44
The Undefined type......Page 45
The Number type......Page 46
The String type......Page 48
Conversions......Page 49
Converting to a string......Page 50
Converting to a number......Page 51
Type Casting......Page 52
Reference Types......Page 53
The Object class......Page 54
The Number class......Page 55
The String class......Page 57
The instanceof operator......Page 60
Unary operators......Page 61
Bitwise operators......Page 65
Boolean operators......Page 71
Multiplicative operators......Page 74
Additive operators......Page 75
Relational operators......Page 77
Equality operators......Page 78
Assignment operators......Page 80
The if statement......Page 81
Iterative statements......Page 82
The break and continue statements......Page 84
The switch statement......Page 86
Functions......Page 87
No overloading......Page 89
The arguments object......Page 90
The Function class......Page 91
Closures......Page 93
Summary......Page 94
Object-Oriented Terminology......Page 95
Declaration and instantiation......Page 96
Early versus late binding......Page 97
Native objects......Page 98
Built-in objects......Page 109
Host objects......Page 115
Static is not static......Page 116
The this keyword......Page 117
Factory paradigm......Page 118
Constructor paradigm......Page 120
Prototype paradigm......Page 121
Hybrid constructor/prototype paradigm......Page 122
Dynamic prototype method......Page 123
Hybrid factory paradigm......Page 124
A practical example......Page 125
Creating a new method......Page 127
Redefining an existing method......Page 128
Very late binding......Page 129
Summary......Page 130
Inheritance in Action......Page 131
Implementing Inheritance......Page 132
Methods of inheritance......Page 133
A more practical example......Page 139
Alternative Inheritance Paradigms......Page 143
zInherit......Page 144
xbObjects......Page 148
Summary......Page 152
The tag......Page 153
External file format......Page 154
Inline code versus external files......Page 155
Tag placement......Page 156
To hide or not to hide......Page 157
The tag......Page 158
Changes in XHTML......Page 159
Basic SVG......Page 161
The tag in SVG......Page 162
Tag placement in SVG......Page 163
The window object......Page 164
The document object......Page 177
The location object......Page 181
The navigator object......Page 183
The screen object......Page 184
Summary......Page 185
Introduction to XML......Page 187
An API for XML......Page 190
Hierarchy of nodes......Page 191
Language-Specific DOMs......Page 194
Accessing relative nodes......Page 195
Dealing with attributes......Page 197
Accessing specific nodes......Page 199
Creating and manipulating nodes......Page 201
Attributes as properties......Page 206
Table methods......Page 207
NodeIterator......Page 210
TreeWalker......Page 215
Detecting DOM Conformance......Page 217
Summary......Page 219
Regular Expression Support......Page 221
Using a RegExp object......Page 222
Extended string methods......Page 223
Using special characters......Page 225
Character classes......Page 227
Quantifiers......Page 229
Grouping......Page 233
Backreferences......Page 234
Alternation......Page 235
Non-capturing groups......Page 237
Boundaries......Page 238
Understanding the RegExp Object......Page 240
Instance properties......Page 241
Static properties......Page 242
Validating dates......Page 244
Validating credit cards......Page 246
Validating e-mail addresses......Page 250
Summary......Page 251
The Navigator Object......Page 253
User-agent string detection......Page 254
Netscape Navigator 3.0 and Internet Explorer 3.0......Page 255
Netscape Communicator 4.0 and Internet Explorer 4.0......Page 257
Mozilla......Page 258
Opera......Page 260
Epilogue......Page 261
First Steps......Page 262
Detecting Opera......Page 265
Detecting Konqueror/Safari......Page 267
Detecting Internet Explorer......Page 269
Detecting Mozilla......Page 270
Detecting Netscape Communicator 4.x......Page 271
Methodology......Page 272
Detecting Windows operating systems......Page 273
Detecting Macintosh operating systems......Page 275
Detecting Unix operating systems......Page 276
The Full Script......Page 277
Example: A Login Page......Page 280
Summary......Page 287
Events Today......Page 289
Event bubbling......Page 290
Event capturing......Page 292
DOM event flow......Page 293
Event Handlers/Listeners......Page 294
Internet Explorer......Page 295
DOM......Page 296
Locating......Page 298
Properties/methods......Page 299
Similarities......Page 302
Differences......Page 304
Types of Events......Page 307
Mouse events......Page 308
Keyboard events......Page 312
HTML events......Page 314
Mutation events......Page 319
Adding/removing event handlers......Page 320
Formatting the event object......Page 322
Getting the event object......Page 327
Example......Page 328
Summary......Page 329
Scripting Styles......Page 331
DOM style methods......Page 333
Custom tooltips......Page 335
Collapsible sections......Page 336
Accessing style sheets......Page 337
Computed styles......Page 340
innerText and innerHTML......Page 342
outerText and outerHTML......Page 343
Ranges in the DOM......Page 345
Ranges in Internet Explorer......Page 357
Summary......Page 361
Form Basics......Page 363
Getting form references......Page 365
Form field commonalities......Page 366
Focus on the first field......Page 367
Submitting forms......Page 368
Submit only once......Page 369
Text boxes......Page 370
Retrieving/changing a text box value......Page 371
Selecting text......Page 372
Select text automatically......Page 373
Tab forward automatically......Page 374
Limit textarea characters......Page 375
Allowing/blocking characters in text boxes......Page 377
Numeric text boxes with the up/down arrow keys......Page 382
List Boxes and Combo Boxes......Page 384
Retrieving/changing the selected option(s)......Page 385
Adding options......Page 387
Removing options......Page 388
Reordering options......Page 389
Matching......Page 390
The guts......Page 391
Summary......Page 393
The Starting Point — Arrays......Page 395
Sorting a One-Column Table......Page 397
The sortTable() function......Page 399
Sorting a Multicolumn Table......Page 401
The comparison function generator......Page 402
Modifying the sortTable() function......Page 403
Sorting in descending order......Page 404
Sorting with different data types......Page 405
Advanced sorting......Page 409
Summary......Page 413
System Drag and Drop......Page 415
Drag-and-drop events......Page 416
The dataTransfer object......Page 421
The dragDrop() method......Page 425
Simulated Drag and Drop......Page 427
The code......Page 428
Creating drop targets......Page 431
zDragDrop......Page 433
Events......Page 434
Example......Page 436
Summary......Page 437
The Importance of Error Handling......Page 439
Errors versus Exceptions......Page 440
Internet Explorer (Windows)......Page 441
Internet Explorer (MacOS)......Page 443
Mozilla (all platforms)......Page 444
Safari (MacOS X)......Page 445
Opera 7 (all platforms)......Page 446
The onerror event handler......Page 447
The try...catch statement......Page 451
Using alerts......Page 456
Using the Java console......Page 457
Posting messages to the JavaScript console (Opera 7+ only)......Page 458
Throwing your own errors......Page 459
Microsoft Script Debugger......Page 460
Venkman – Mozilla’s debugger......Page 463
Summary......Page 471
XML DOM support in IE......Page 473
XML DOM support in Mozilla......Page 478
Making interfaces play together......Page 483
XPath Support in Browsers......Page 493
Introduction to XPath......Page 494
XPath support in Mozilla......Page 495
XSLT Support in Browsers......Page 499
XSLT support in IE......Page 501
XSLT support in Mozilla......Page 505
Summary......Page 507
Cookies......Page 509
Other security restrictions......Page 510
Cookies in JavaScript......Page 511
Cookies on the server......Page 513
Passing cookies between client and server......Page 516
Hidden Frames......Page 518
Using iframes......Page 519
HTTP Requests......Page 521
Using headers......Page 523
Performing a GET request......Page 524
Performing a POST request......Page 525
Performing a GET request......Page 526
Performing a POST request......Page 528
The get() method......Page 530
The post() method......Page 533
Practical Uses......Page 534
Summary......Page 535
What is a Web service?......Page 537
WSDL......Page 538
Using the WebService component......Page 541
WebService component example......Page 543
Web Services in Mozilla......Page 544
Enhanced privileges......Page 545
Using the SOAP methods......Page 546
Using WSDL proxies......Page 550
The WebService object......Page 553
The Temperature Service......Page 555
Using the TemperatureService object......Page 557
Summary......Page 558
Why Use Plugins?......Page 559
Popular Plugins......Page 560
Embedding Plugins......Page 561
Netscape 4.x......Page 562
Detecting Netscape-style plugins......Page 563
Detecting ActiveX plugins......Page 568
Cross-browser detection......Page 570
Embedding applets......Page 571
Referencing applets in JavaScript......Page 572
Writing applets......Page 573
JavaScript-to-Java communication......Page 574
Java-to-JavaScript communication......Page 576
Flash Movies......Page 579
Referencing Flash movies......Page 580
JavaScript-to-Flash communication......Page 581
Flash-to-JavaScript communication......Page 583
ActiveX Controls......Page 586
Summary......Page 589
The Same Origin Policy......Page 591
Window object issues......Page 592
Mozilla-specific issues......Page 594
Internationalization Concerns......Page 596
Strategies......Page 597
String considerations......Page 598
Download time......Page 601
Execution time......Page 606
Obfuscating......Page 621
Microsoft Script Encoder (IE only)......Page 622
Summary......Page 623
ECMAScript 4......Page 625
Netscape’s proposal......Page 626
Implementations......Page 632
Approach......Page 633
New classes......Page 635
Summary......Page 644
Index......Page 645
A......Page 646
B......Page 647
C......Page 648
D......Page 650
E......Page 652
F......Page 655
H......Page 656
I......Page 657
J......Page 659
O......Page 663
Q......Page 666
V......Page 672
X......Page 674

Professional JavaScript for Web developers
 9780764579080, 0764579088

  • Commentary
  • 1146067566*Отл
  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers