JavaScript Bible / Edition 7

Paperback (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 96%)
Other sellers (Paperback)
  • All (16) from $1.99   
  • New (8) from $9.97   
  • Used (8) from $1.99   


The bestselling JavaScript reference, now updated to reflect changes in technology and best practices

As the most comprehensive book on the market, the JavaScript Bible is a classic bestseller that keeps you up to date on the latest changes in JavaScript, the leading technology for incorporating interactivity into Web pages. Part tutorial, part reference, this book serves as both a learning tool for building new JavaScript skills as well as a detailed reference for the more experienced JavaScript user.

You'll get up-to-date coverage on the latest JavaScript practices that have been implemented since the previous edition, as well as the most updated code listings that reflect new concepts. Plus, you'll learn how to apply the latest JavaScript exception handling and custom object techniques.

Coverage includes:

  • JavaScript's Role in the World Wide Web and Beyond
  • Developing a Scripting Strategy
  • Selecting and Using Your Tools
  • JavaScript Essentials
  • Your First JavaScript Script
  • Browser and Document Objects
  • Scripts and HTML Documents
  • Programming Fundamentals
  • Window and Document Objects
  • Forms and Form Elements
  • Strings, Math, and Dates
  • Scripting Frames and Multiple Windows
  • Images and Dynamic HTML
  • The String Object
  • The Math, Number, and Boolean Objects
  • The Date Object
  • The Array Object
  • JSON - Native JavaScript Object Notation
  • E4X - Native XML Processing
  • Control Structures and Exception Handling
  • JavaScript Operators
  • Function Objects and Custom Objects
  • Global Functions and Statements
  • Document Object Model Essentials
  • Generic HTML Element Objects
  • Window and Frame Objects
  • Location and History Objects
  • Document and Body Objects
  • Link and Anchor Objects
  • Image, Area, Map, and Canvas Objects
  • Event Objects

Practical examples of working code round out this new edition and contribute to helping you learn JavaScript quickly yet thoroughly.

Read More Show Less

Editorial Reviews

The author covers the basics of document objects and forms, control structures, functions, operators, Java applets, the differences between Netscape and Microsoft's implementations of JavaScript, cross- browser dynamic HTML applications, and debugging tools. Includes beginning and advanced tutorials, and appends answers to the tutorial exercises as well as a list of JavaScript Internet resources. The CD- ROM contains the complete JavaScript for the examples in the book and seven additional chapters with working applications, including calendars, forms, graphics, intelligent flags, and a decision helper. Annotation c. by Book News, Inc., Portland, Or.
Read More Show Less

Product Details

  • ISBN-13: 9780470526910
  • Publisher: Wiley
  • Publication date: 11/9/2010
  • Series: Bible Series, #619
  • Edition number: 7
  • Pages: 1224
  • Sales rank: 955,546
  • Product dimensions: 7.40 (w) x 9.20 (h) x 2.30 (d)

Meet the Author

Danny Goodman is the author of numerous critically acclaimedand best-selling books, including The Complete HyperCardHandbook, Danny Goodman’s AppleScript Handbook,Dynamic HTML: The Definitive Reference, and JavaScript& DHTML Cookbook. He is a renowned authority on and expertteacher of computer scripting languages. His writing style andpedagogy continue to earn praise from readers and teachers aroundthe world.

Michael Morrison is a writer, developer, toy inventor,and author of a variety of books covering topics such as Java, C++,Web scripting, XML, game development, and mobile devices. Some ofMichael’s notable writing projects include Faster SmarterHTML and XML, Teach Yourself HTML & CSS in 24 Hours,and Beginning Game Programming. Michael is also the founderof Stalefish Labs (, an entertainment companyspecializing in unusual games, toys, and interactive products.

Paul Novitski has been writing software as a freelanceprogrammer since 1981. He once taught himself BASIC in order towrite a machine language disassembler so that he could lovinglyhack Wang’s OIS microcode. He has focused on internetprogramming since the late ’90s. His company, JuniperWebcraft, produces HTML-strict websites featuring accessible,semantic markup, separation of development layers, and intuitiveuser interfaces. He knows the righteousness of elegant code, thepoignancy of living on the bleeding edge of wilderness, the sweetmelancholy of mbira music, and the scorching joy of raising twinboys.

Tia Gustaff Rayl is a consultant who does development andtraining in database and Web technologies. Most recently she haspublished courseware for XHTML, CSS, JavaScript, and SQL. It comesas no surprise to those who know her that she began her softwarecareer with degrees in English and Education from the University ofFlorida. As is usual for most newcomers to the field, herintroduction to computing was maintaining software. She went on toa long-standing career in the software industry in full life cyclesystem, application, and database development; project management;and training for PC and mainframe environments. In the mid-ninetiesshe worked on early Web-enabled database applications, addingJavaScript to her repertoire. She continues to take on developmentprojects to maintain her code-slinging skills. If she had any sparetime (and money) she would go on an around-the-world cruise withher husband and two dogs.

Read More Show Less

Read an Excerpt


For nearly 20 years, I have written the books I wished had already been written to help me learn or use a new technology. Whenever possible, I like to get in at the very beginning of a new authoring or programming environment, feel the growing pains, and share with readers the solutions to my struggles. This fourth edition of the JavaScript Bible represents knowledge and experience accumulated over five years of daily work in JavaScript and a constant monitoring of newsgroups for questions, problems, and challenges facing scripters at all levels. My goal is to help you avoid the same frustration and head scratching I and others have experienced through multiple generations of scriptable browsers.

While previous editions of this book focused on the then predominant Netscape Navigator browser, the swing of the browser market share pendulum currently favors Microsoft Internet Explorer. At the same time, Netscape has accomplished the admirable task of reinventing its own browser in light of rapidly advancing industry standards. As a result of both of these trends, this massively revised and expanded fourth edition treats both brands of browsers as equals as far as scripters are concerned. You hear my praise and dismay at various scripting features of both browser families. But empowering you to design and write good scripts is my passion, regardless of browser. Therefore, the book contains details about proprietary and standard implementations to equip you to choose the development path that best fits your content's audience. If you detect any bias of mine throughout this book, it is a desire, where possible, to write scripts that work on as many browsers as possible.

Organization and Features of This Edition

Because of the greatly expanded range of vocabularies that scripts may use in the latest browser versions, the biggest change to the structure of the book is in the reference portion. In this edition, you find a greater distinction between the document object model and core JavaScript language reference sections. This new division should help those readers who are primarily interested in only the JavaScript language (for use in other applications) find what they need more quickly. Here are some details about the book's structure.
Read More Show Less

Table of Contents

Introduction xxv

Part I: Getting Started with JavaScript 1

Chapter 1: JavaScript’s Role in the World Wide Web and Beyond 3

Competing for Web Traffic 4

Other Web Technologies 4

JavaScript: A Language for All 10

JavaScript: The Right Tool for the Right Job 12

Chapter 2: Developing a Scripting Strategy 15

Browser Leapfrog 15

Duck and Cover 16

Compatibility Issues Today 17

Developing a Scripting Strategy 22

Chapter 3: Selecting and Using Your Tools 27

The Software Tools 27

Setting Up Your Authoring Environment 28

Validate, Validate, Validate 31

Creating Your First Script 31

Chapter 4: JavaScript Essentials 37

Combining JavaScript with HTML 37

Designing for Compatibility 51

Language Essentials for Experienced Programmers 54

Part II: JavaScript Tutorial 59

Chapter 5: Your First JavaScript Script 61

What Your First Script Will Do 61

Entering Your First Script 62

Have Some Fun 74

Exercises 75

Chapter 6: Browser and DocumentObjects 77

Scripts Run the Show 77

When to Use JavaScript 78

The Document Object Model 79

When a Document Loads 82

Object References 85

Node Terminology 87

What Defines an Object? 88

Exercises 93

Chapter 7: Scripts and HTML Documents 95

Connecting Scripts to Documents 95

JavaScript Statements 99

When Script Statements Execute 100

Viewing Script Errors 104

Scripting versus Programming 105

Exercises 106

Chapter 8: Programming Fundamentals, Part I 109

What Language Is This? 109

Working with Information 109

Variables 110

Expressions and Evaluation 112

Data Type Conversions 115

Operators 116

Exercises 118

Chapter 9: Programming Fundamentals, Part II 121

Decisions and Loops 121

Control Structures 122

Repeat Loops 124

Functions 124

Curly Braces 128

Arrays 129

Exercises 133

Chapter 10: Window and Document Objects 135

Top-Level Objects 135

The window Object 135

Window Properties and Methods 139

The location Object 142

The navigator Object 143

The document Object 143

Exercises 152

Chapter 11: Forms and Form Elements 153

The Form object 153

Form Controls as Objects 158

Passing Elements to Functions with this 170

Submitting and Prevalidating Forms 173

Exercises 177

Chapter 12: Strings, Math, and Dates 179

Core Language Objects 179

String Objects 180

The Math Object 183

The Date Object 184

Date Calculations 186

Exercises 189

Chapter 13: Scripting Frames and Multiple Windows 191

Frames: Parents and Children 191

References Among Family Members 194

Frame-Scripting Tips 195

About iframe Elements 196

Highlighting Footnotes: A Frameset Scripting Example 196

References for Multiple Windows 202

Exercises 206

Chapter 14: Images and Dynamic HTML 207

The Image Object 207

Rollovers Without Scripts 216

The javascript: Pseudo-URL 219

Popular Dynamic HTML Techniques 220

Exercises 222

Part III: JavaScript Core Language Reference 223

Chapter 15: The String Object 225

String and Number Data Types 225

String Object 228

String Utility Functions 261

URL String Encoding and Decoding 267

Chapter 16: The Math, Number, and Boolean Objects 269

Numbers in JavaScript 269

Math Object 276

Number Object 280

Boolean Object 284

Chapter 17: The Date Object 285

Time Zones and GMT 285

The Date Object 287

Validating Date Entries in Forms 304

Chapter 18: The Array Object 311

Structured Data 311

Creating an Empty Array 312

Populating an Array 313

JavaScript Array Creation Enhancements 314

Deleting Array Entries 315

Parallel Arrays 315

Multidimensional Arrays 320

Simulating a Hash Table 321

Array Object 323

Array Comprehensions 353

Destructuring Assignment 354

Compatibility with Older Browsers 355

Chapter 19: JSON — Native JavaScript Object Notation 357

How JSON Works 357

Sending and Receiving JSON Data 359

JSON Object 360

Security Concerns 361

Chapter 20: E4X — Native XML Processing 363

XML 363

ECMAScript for XML (E4X) 364

Chapter 21: Control Structures and Exception Handling 373

If and If. . .Else Decisions 373

Conditional Expressions 379

The switch Statement 380

Repeat (for) Loops 384

The while Loop 388

The do-while Loop 390

Looping through Properties (for-in) 390

The with Statement 392

Labeled Statements 393

Exception Handling 397

Using try-catch-finally Constructions 398

Throwing Exceptions 402

Error Object 407

Chapter 22: JavaScript Operators 411

Operator Categories 411

Comparison Operators 412

Equality of Disparate Data Types 413

Connubial Operators 415

Assignment Operators 418

Boolean Operators 420

Bitwise Operators 424

Object Operators 425

Miscellaneous Operators 430

Operator Precedence 433

Chapter 23: Function Objects and Custom Objects 437

Function Object 437

Function Application Notes 447

Creating Your Own Objects with Object-Oriented JavaScript 458

Object-Oriented Concepts 470

Object Object 474

Chapter 24: Global Functions and Statements 481

Functions 482

Statements 492

WinIE Objects 496

Part IV: Document Objects Reference 501

Chapter 25: Document Object Model Essentials 503

The Object Model Hierarchy 503

How Document Objects Are Born 505

Object Properties 506

Object Methods 507

Object Event Handlers 508

Object Model Smorgasbord 509

Basic Object Model 510

Basic Object Model Plus Images 511

Navigator 4–Only Extensions 511

Internet Explorer 4+ Extensions 512

Internet Explorer 5+ Extensions 515

The W3C DOM 516

Scripting Trends 532

Standards Compatibility Modes (DOCTYPE Switching) 534

Where to Go from Here 535

Chapter 26: Generic HTML Element Objects 537

Generic Objects 537

Chapter 27: Window and Frame Objects 739

Window Terminology 739

Frames 740

Window Object 746

Frame Element Object 854

Frameset Element Object 862

iframe Element Object 868

Popup Object 875

Chapter 28: Location and History Objects 881

Location Object 881

History Object 900

Chapter 29: Document and Body Objects 907

Document Object 908

Body Element Object 981

TreeWalker Object 990

Chapter 30: Link and Anchor Objects 995

Anchor, Link, and a Element Objects 995

Chapter 31: Image, Area, Map, and Canvas Objects 1003

Image and img Element Objects 1003

Area Element Object 1024

Map Element Object 1028

Canvas Element Object 1032

Chapter 32: Event Objects 1043

Why ‘‘Events’’? 1044

Event Propagation 1045

Referencing the event Object 1059

Binding Events 1059

Event Object Compatibility 1064

Dueling Event Models 1066

Event Types 1070

NN6+/Moz event Object 1097

Part V: Appendixes 1123

Appendix A: JavaScript and Browser Objects Quick Reference 1125

Appendix B: What’s on the CD-ROM 1133

Index 1137

Read More Show Less

Customer Reviews

Average Rating 2.5
( 4 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted June 13, 2013

    No CD-ROM in e-book!?

    The print version of this book ships with a CD-ROM which includes several chapters not included in the text. In addition, the CD is supposed to have lots of sample scripts and other materials referred to in the book. This is not just a "bonus", it is essential to using this book. Where is the digital equivalent of the CD? Without it, much of this book is worthless.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Posted January 19, 2011

    "indoo" worst Customer Service I have ever had

    Ordered this book back on 19 Dec 2010, they shipped the wrong book on 22 Dec 2010. Asked for someone to call me about three weeks ago, but to this day even with me asking four time and giving them a number that I'm at 24/7 they have refused to call with no explaination. I do not know at this time if they are even going to ship me the book I ordered. They do not seem to understand simple English. I have stated a number of times that I still want the book I ordered. I was forced to return the book they sent in it's original package marked as "Return to Sender" because they were so slow in giving return instructions. I am sorry, but I will not pay to return a book that I did not order when the seller takes so long to give instructions for the return. THey also didn't mention that they would reimburse the return cost until three days after I had put in in the mail as mentioned above. All I can do is hope that I get the book I ordered or that they refund my money, But I want the book. At this point I wish that I could set my rating as ZERO STARS, but the system will not allow that.

    1 out of 5 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted March 24, 2012

    Re: "indoo"

    Better get this version then! It comes in instantly.

    0 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)