How to do Everything with JavaScript

Free Download

Authors:

Edition: 1

Series: How to do everything with

ISBN: 9780072228878, 0-07-222887-3

Size: 8 MB (7971752 bytes)

Pages: 369/369

File format:

Language:

Publishing Year:

Category:

Scott Duffy9780072228878, 0-07-222887-3

This friendly, solutions-oriented guide is filled with step-by-step examples that illustrate how to write basic to advanced JavaScript applications, as well as modify existing scripts to suit individual needs. Each chapter begins with the specific how-to topics that will be covered. Within the chapter, each topic is accompanied by a solid, easy-to-follow walkthrough of the process.

Table of contents :
Cover……Page 1
Contents……Page 10
Acknowledgments……Page 16
Introduction……Page 18
PART I Learn JavaScript Basics……Page 20
CHAPTER 1 Prepare to Program in JavaScript……Page 22
Learn the History of JavaScript……Page 23
JavaScript Becomes an Official Standard……Page 24
Where JavaScript Is Today……Page 25
Develop JavaScript-Enabled Web Pages……Page 26
Create Server-Based Web Applications……Page 27
JavaScript Development Tools……Page 28
Learn What JavaScript Can and Cannot Do……Page 32
Use JavaScript as a Server-Side Language……Page 33
Decide Which Version of JavaScript to Use……Page 34
Create a JavaScript Template……Page 35
Understand the JavaScript Template……Page 37
Communicate with the User……Page 38
Display an Alert Message……Page 39
Write Text to the Browser Window……Page 40
Learn More about Topics Discussed in this Chapter……Page 41
CHAPTER 2 Learn JavaScript Fundamentals……Page 44
Store Data in Variables……Page 45
Define Variables……Page 46
Define Constants……Page 47
Understand Program Flow……Page 48
Execute Code Conditionally……Page 49
Repeat Statements Using Loops……Page 53
Comment Your Code……Page 62
Set a Default Object……Page 63
Handle Errors……Page 65
Understand the Basics of Expressions……Page 68
Use Operators to Create Complex Expressions……Page 69
Organize Your Code into Functions……Page 70
Define Functions……Page 71
Accept Parameters……Page 73
Understand Variable Scope……Page 75
Return Values……Page 77
Use the Improvements in JavaScript 2.0 to Create More Powerful Functions……Page 78
Use Named Optional Parameters……Page 79
Accept Any Number of Parameters……Page 80
CHAPTER 3 Use Built-in JavaScript Classes……Page 82
Learn about Objects in JavaScript……Page 83
Organize Code into Procedures……Page 84
Use the Object-Oriented Approach……Page 85
Turn Properties and Functions into a Class……Page 87
JavaScript’s Built-in Classes and Data Types……Page 88
Instantiate an Object with the new Operator……Page 91
Create a String Object in JavaScript……Page 92
Create a String Object Using a String Literal……Page 93
Use the String Object’s Built-in Functionality……Page 95
Perform Mathematical Functions……Page 97
Apply JavaScript’s Date-Handling Functions……Page 98
Use the parseInt and parseFloat Functions……Page 101
Prepare Text Before Sending to Web Server……Page 103
Use the escape and unescape Functions……Page 104
Decide When to Use Regular Expressions……Page 105
Understand the Basics of Regular Expressions……Page 106
Create Patterns with a RegExp Object……Page 108
Use the char Data Type……Page 110
Understand Special Data Types……Page 111
CHAPTER 4 Organize Data into Arrays……Page 114
Create an Empty Array……Page 116
Specify an Initial Array Length……Page 118
Use Array Literals……Page 119
Call the Properties and Methods of the Array Object……Page 120
Set and Retrieve Values in an Array……Page 123
Use Multidimensional Arrays……Page 126
Use JavaScript 2.0’s Enhanced Arrays……Page 130
The StaticArray Class……Page 131
The ConstArray Class……Page 133
CHAPTER 5 Create Your Own JavaScript Classes……Page 136
Create Objects in JavaScript 1.x……Page 137
Call a Constructor Function……Page 138
Use an Object Literal……Page 141
Extend an Existing Class……Page 142
Extend an Existing Object……Page 144
Create Objects in JavaScript 2.0……Page 145
Define Your Own Classes……Page 146
Organize Classes Using Inheritance……Page 149
Choose Between Static and Instance Members……Page 154
Make Class Members Public or Private……Page 155
PART II Build JavaScript-Enabled Web Sites……Page 158
CHAPTER 6 Embed JavaScript in a Web Page……Page 160
Understand Basic HTML Structure……Page 161
Build an HTML Document……Page 164
Indicate the Document Type with ……Page 165
Add a Title and Define Document Keywords……Page 166
Format Text with HTML Elements……Page 167
Format Text with Style Sheets……Page 169
Use to Add JavaScript to a Web Page……Page 172
Use for Browsers That Don’t Support Scripting……Page 173
Load an External JavaScript File……Page 176
Call JavaScript Using Hyperlinks……Page 177
Learn More about the Topics in this Chapter……Page 178
CHAPTER 7 Create Scripts That Work in Every Browser……Page 180
Understand Browser Differences……Page 181
What Kind of Errors Can Occur?……Page 182
Detect What Type of Browser the User Is Running……Page 183
Query the Document Model……Page 188
Stick to Web Standards……Page 189
Write Cross-Browser Code……Page 190
CHAPTER 8 Manipulate Web Forms……Page 198
Understand HTML Forms……Page 199
Request User Input Using an HTML Form……Page 200
Process Form Input with Client-Side JavaScript……Page 201
Process Form Input on a Web Server……Page 202
Insert an HTML Form into a Web Page……Page 203
Access Form Values Using the forms Array……Page 219
Access Form Values Using the elements Array……Page 221
Access Form Values Using getElementsByName()……Page 223
Access Form Values Using getElementsByTagName()……Page 224
CHAPTER 9 Handle Browser Events……Page 226
Write JavaScript Event Handlers……Page 227
Handle User Interface Events……Page 228
Handle Mouse Events……Page 230
Handle Key Events……Page 231
Handle HTML Events……Page 234
Handle Events Using the Event Property……Page 237
Call the Method Associated with an Event……Page 238
Overcome Browser Incompatibility……Page 239
CHAPTER 10 Communicate Between Browser Frames……Page 242
Learn the Basics of HTML Frames……Page 243
Create a Frameset in HTML……Page 244
Define and Name Frames in a Frameset……Page 252
Call JavaScript Functions from Other Frames……Page 254
Access Another Frame Using JavaScript……Page 255
Call a JavaScript Function Located in Another Frame……Page 256
Handle Synchronization Between Frames……Page 258
CHAPTER 11 Interact with the Web Browser……Page 262
Learn the Basics of the Document Object Model……Page 264
Manipulate the Contents of a Web Page……Page 267
Dynamically Modify the Contents of a Web Page……Page 268
Change the Items in a Drop-Down List Box……Page 270
Examine the Entire Browser Window……Page 271
Retrieve Properties of the Web Browser Software……Page 273
Examine the Operating System’s Display Settings……Page 275
Access the Web Browser History List……Page 276
Send the Browser to a New Location……Page 277
CHAPTER 12 Perform Simple Animation……Page 278
Learn the Basics of Cascading Style Sheets……Page 279
Assign Style to Web Pages Using HTML Elements……Page 280
Assign Style to Web Pages Using Style Sheets……Page 283
Position Elements on a Web Page……Page 287
Modify Styles Using JavaScript……Page 289
Understand Cross-Platform Issues……Page 291
Dynamically Load Images……Page 293
Make Content Move Around the Screen……Page 295
PART III Take JavaScript to the Next Level……Page 298
CHAPTER 13 Debug JavaScript Programs……Page 300
Understand the Possible Causes of Errors……Page 301
Find the Source of an Error Message……Page 303
Interpret Error Messages……Page 304
Add Debugging Code to Your Programs……Page 306
Use the JavaScript Console……Page 309
Use a JavaScript Debugger……Page 310
CHAPTER 14 Make Your Program Errorproof……Page 314
Learn the Basics of Exceptions……Page 315
Catch Exceptions Using the try and catch Statements……Page 316
Understand Exception Bubbling……Page 318
Use the IE Error Object……Page 320
Use Nonstandard finally Clauses……Page 321
Create Exceptions Using the throw Statement……Page 323
Design Programs That Are Easy to Debug from the Start……Page 325
Break Code into Manageable Chunks……Page 326
Reuse Code Using Classes and Objects……Page 327
Create a Testing Harness……Page 328
Force Errors to Test Error-Handling Code……Page 330
Try Your Program in Many Different Environments……Page 331
CHAPTER 15 Use JavaScript to Manage Browser Plug-Ins……Page 332
Include Sun Java Applets……Page 334
Connect to Java Applets Using JavaScript……Page 338
Embed Movies and Music in Web Pages……Page 340
Connect to Music and Media Objects Using JavaScript……Page 341
Use the Microsoft Calendar Control in Your Web Pages……Page 343
APPENDIX A HTML 4.01 Tags……Page 346
APPENDIX B JavaScript Quick Reference……Page 350
Index……Page 354

Reviews

There are no reviews yet.

Be the first to review “How to do Everything with JavaScript”
Shopping Cart
Scroll to Top