CDN$ 42.65
  • List Price: CDN$ 48.90
  • You Save: CDN$ 6.25 (13%)
Temporarily out of stock.
Order now and we'll deliver when available. We'll e-mail you with an estimated delivery date as soon as we have more information. Your account will only be charged when we ship the item.
Ships from and sold by Gift-wrap available.
Learning JavaScript: Add ... has been added to your Cart
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Learning JavaScript: Add Sparkle and Life to Your Web Pages Paperback – Dec 26 2008

See all 2 formats and editions Hide other formats and editions
Amazon Price
New from Used from
Kindle Edition
"Please retry"
"Please retry"
CDN$ 42.65
CDN$ 32.31 CDN$ 23.22

There is a newer edition of this item:

Learning JavaScript: Add Sparkle and Life to Your Web Pages
CDN$ 39.14
This title has not yet been released.

Save an Additional 10% on Textbooks When you Join Amazon Student

Special Offers and Product Promotions

  • Amazon Student members save an additional 10% on Textbooks with promo code TEXTBOOK10. Enter code TEXTBOOK10 at checkout. Here's how (restrictions apply)

No Kindle device required. Download one of the Free Kindle apps to start reading Kindle books on your smartphone, tablet, and computer.

  • Apple
  • Android
  • Windows Phone
  • Android

To get the free app, enter your e-mail address or mobile phone number.

Product Details

  • Paperback: 398 pages
  • Publisher: O'Reilly Media; 2 edition (Dec 26 2008)
  • Language: English
  • ISBN-10: 0596521871
  • ISBN-13: 978-0596521875
  • Product Dimensions: 17.8 x 2 x 23.3 cm
  • Shipping Weight: 476 g
  • Average Customer Review: Be the first to review this item
  • Amazon Bestsellers Rank: #505,548 in Books (See Top 100 in Books)
  •  Would you like to update product info, give feedback on images, or tell us about a lower price?

  • See Complete Table of Contents

Product Description

About the Author

Shelley Powers has been working with, and writing about, web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 12 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado, who enjoys applying her latest experiments on her many web sites.

Inside This Book

(Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Customer Reviews

There are no customer reviews yet on
5 star
4 star
3 star
2 star
1 star

Most Helpful Customer Reviews on (beta) HASH(0xa5d6b060) out of 5 stars 42 reviews
59 of 65 people found the following review helpful
HASH(0xa5d73c48) out of 5 stars decent introduction, marred by typos Nov. 9 2006
By Thing with a hook - Published on
Format: Paperback
As an introduction to javascript, this book covers all the ground you'd hope it would. It introduces JS in the context of a standalone programming language with its various procedural constructs, before moving onto the Document Object Model and Browser Object Model, touches upon objects, and finds the time to explain Ajax. Finally, there's a whistlestop tour of the commonly used JS libraries like Dojo, Prototype and Shelley Powers also sprinkles her opinions on JS best practices throughout, with a bias towards favouring accessibility over whiz-bang flashiness. I would recommend being comfortable with XHTML and CSS as a prerequisite for this book - something like O'Reilly's own Head First XHTML and CSS would be very suitable.

If, like me, you know a few programming languages, but nothing about JS, and wanted a crash course so you could understand what all the fuss about the likes of Ajax or the Google Web Toolkit is, this is just what you need. So why am I only giving it three stars?

First, I thought some of the features weren't very well explained - the writing lacks clarity when describing important points. Compounding this, a few of the examples are poorly chosen. Some of my quibbles may seem picky, but the feel of the book is that it's pitched at an inexperienced programmer, and a lot of the time I only followed the discussion because I was already familiar with the material from other languages. Some particular points follow.

i) Accessing the length of various parts of a multidimensional array is illustrated with:

alert(threedPoints[2][2].length); // prints out 3

alert(threedPoints[2].length); // prints out 3

alert(threedPoints.legnth); // prints out 3

ignoring the error on the third line (more on that later), as can be seen from the comments, a three dimensional array has been created where every dimension is of length 3 - surely making them of unequal size would have been more illustrative.

ii) The example of the associative array manages to be even worse:

assocArray["one"] = "one";

assocArray["two"] = "two";

I struggle to think of an example that could be more misleading.

iii) While the author recognises the importance of regular expressions, and goes into reasonable detail, the material is not terribly well organised, and the examples become complicated too quickly.

iv) The section on chained constructors, and the use of call and apply is also unclear - disappointing, given I was most interested in the prototype style of object creation that JS uses.

v) The callback functions of Array are not well described. The function Filter, apparently, "ensures that elements are not added to any element unless they pass certain criteria". So, elements are not added to any element - huh? wha? Those familiar with the likes of Lisp, Python, and especially the iterators in Smalltalk and Ruby will be able to pick up what's going on, but newcomers may be baffled.

vi) The attempt to explain recursion is weak. Admittedly, most programming books do a bad job, but what's here is far too short to be useful. An illustrative quote is: "think of each iteration of the function call as pushing the string and numeric sum onto a stack, and when the numeric array has been traversed, the string and number have to be popped up through the stack to the top". I'm not saying this is wrong, but I do not believe that someone who's just been introduced to recursion would find this description helpful.

vii) Not all the programs have their output shown. This wouldn't be easy for some of the more complicated examples, but a lot of them are text-based.

Second, there are lots and lots of typos in the book. When even a JS noob such as myself spots them, you know there's something up. Fortunately, they're only minor, and they generally aren't sufficiently bad to mislead. As an example, when function literals are introduced, the rather vital keyword 'function' is missing, but the examples quickly clarify the matter. However, elsewhere, some of the code won't actually run as presented (as early as the second example, alas), and it does take the shine off the production. Either the technical reviewers were asleep, or the editors at O'Reilly ignored them. Someone ought to be embarrassed, at any rate.

None of these things are sufficiently show-stopping for someone who knows a little programming, so I would still recommend this book before wrestling with enormous tomes like David Flanagan's JavaScript - The Essential Guide, or a dedicated Ajax book. Complete beginners and the inexperienced, however, should look elsewhere, I'm afraid.
41 of 45 people found the following review helpful
HASH(0xa589206c) out of 5 stars Well done, intelligent, clear and useful; but not for the complete novice March 10 2009
By M. Helmke - Published on
Format: Paperback
I recently became the maintainer for a site that uses a bit of JavaScript. Surprisingly, I have no previous experience writing or maintaining anything in JavaScript, so I needed to get up to speed, if only to know what is going on. To help me out, I picked up a copy of Shelley Powers' new book, Learning JavaScript.

I am familiar with Shelley Powers' work, having read Unix Power Tools, a book that holds a special place on my shelf for its usefulness and depth. She is obviously someone who knows what she is doing.

This book states in the preface that, "Readers of this book should be familiar with web page technology, including Cascading Style Sheets (CSS) and HTML/XHTML. Previous programming experience isn't required, though some sections may require extra review if you have no previous exposure to programming."

That sums up the only negative thing I might be tempted to say about the book. Usually, O'Reilly's "Learning" series books are excellent resources for complete newcomers and are the sort of books that I might point a novice toward. While this book is designed for the JavaScript novice, it is not the best resource for a programming/web creation novice. If you can't follow or understand the following quoted sentences, this book isn't for you. If you can, this book does an excellent job of covering the basics of JavaScript in depth and may end up being the only text you need on the topic.

"JavaScript has just three primitive data types: string, numeric, and boolean. Each is differentiated from the others by the type of value it contains: string, numeric, and boolean, respectively."

My first exposure to programming was in 1981, using BASIC on a Radio Shack TRS-80 Color Computer. Over the years, I have studied (and often forgotten, but can certainly read a bit and understand the concepts of) LISP, C, Bash scripting, Perl, Python, and more. Lately I have spent more time using PHP and enjoying it, since that is the language of things like Wordpress, Drupal, vBulletin and other commonly used CMS and interactive web site software. The two sentences quoted above seem perfectly clear to me, but I can imagine what they must seem like to someone with no experience with programming languages. So, now you have been warned. Let's get to the good stuff for those who understand the jargon.

This book is clear, with enough detail to help you understand what is happening without bogging you down in the minutiae. The reader is expected to see how and why each facet of the language would be useful, so the examples given are simple and seem to be designed to help the reader get the feel for usage without pretending to be a cookbook of programming recipes, although some seem quite useful as they are, such as Chapter 6's code for browser detection, which allows you to modify content and/or how it is displayed based on the web browser being used to view your site.

The text covers everything you are likely to need while using JavaScript, and more importantly for me, most everything a person is likely to stumble across when reading existing code. You get a solid introduction to data types and variables, operators, statements, objects, and functions. This is built upon with chapters on debugging and cross-browser compatibility. This new second edition (just released earlier in 2009) has several updates and changes from the previous version including a wonderful comparison of the benefits of generating and processing XML data using Ajax versus using JSON.

If you are considering using JavaScript on a website that includes the dynamic creation of web pages, or if you have inherited one that you are now responsible for maintaining, this book would be a good resource to help you start to understand one of the more common languages used for doing so. This is especially true if you have any prior experience with any other programming language. If you want a cookbook, scripted-style, "do this, now do that" sort of beginner's guide to making a site that holds your hand through the whole process, this is not the book you want.
21 of 21 people found the following review helpful
HASH(0xa58920e4) out of 5 stars Not for Beginners! Sept. 3 2009
By Don Rogerson - Published on
Format: Paperback
I have to concur that while this book is marketed as a book for newcomers to javascript, it is too full of unexplained terminology for the beginner. I am very familiar with HTML and CSS, and the introduction to this book claims that should have been good enough for a starting point, but here I am scratching my head about every third sentence and having to run to the web for clarification.

Other "beginning" O'Reilly books I have used relied on a tutorial model that starts with a "hello world" example and builds upon it to introduce more complicated concepts. Powers' book does indeed start with a "hello world" example, but does not build upon it. Instead, each chapter focuses on a particular facet and provides isolated examples that are not connected back to previous examples. It is arranged more like a basic reference text than a learning tool.
16 of 17 people found the following review helpful
HASH(0xa5892474) out of 5 stars Not for beginners Nov. 13 2009
By dennisd - Published on
Format: Paperback
I am trudging through this book right now, and as a beginner who has no prior experience with JavaScript, I can tell you that this book isn't for the beginner. I've gone through a few examples and typed in the code as written and found that a few of the examples don't even work. I'm sure that it was written using some sort of word processing software, so what made it so hard to copy and paste the JavaScript code into a file to check to see if the code actually works? Also, I don't understand why the examples are so complex. After reading and rereading the script examples, I can usually figure it out, but having to do that is why I say that this book is not for the beginner.

The good part about this book, is that I am actually learning the material. The "test" questions at the end of the chapter range from simple to intermediate, and I can answer all of them correctly. I just wish it was a bit easier to read for us beginners.
11 of 12 people found the following review helpful
HASH(0xa58925ac) out of 5 stars Ughhh!!!! Aug. 14 2008
By William H. White - Published on
Format: Paperback
One does not read this book; one is tortured by it.

There are two major complaints I have with this book. The first is the number of errors in the text. (If you read another review of this book and it does not cite the problem with errors very early in the review, then you must be reading a review from Ms. Powers's fiance, sister-in-law, best friend, or cousin.) I have never seen anything close to this level of ineptitude in any other book I have ever read, programming-related or not. Just to tip-toe through this cow pasture:
- By my quick count, there are eighty-three errors listed on the book's errata web page. (It took me about two hours simply to go through the book and write in all of the corrections from the errata page.)
- Ms. Powers occasionally manages more than one error per page.
- Not only do the errors occur often, the arise early. There are errors in each of the book's first three Examples, with Example 1-3 alone mangaging to contain two errors.
- Beginning with Chapter 2, Ms. Powers concludes each chapter with a number of exercise questions - the answers to which are provided at the end of the book. Of the five Chapter 2 answers (i.e., the first five questions and answers in the book) there are errors in three.
- Page 11 is missing, well, two pages! The errata file contains ten paragraphs of text that is missing!
- Any number of errors are "simple" typos: the text uses a hyphen when there should be an underscore, variable names are misspelled, errant characters are enclosed, words are duplicated - that kind of thing. While this is sloppy and wholly unprofessional, one could argue that in The Grand Scheme of Things such errors are minor. However, a number of errors are more egregious. For example [all CAPS are mine]....
-On page 94 the book talks about how "the shift RETURNS the first element." Oops! The text should talk about how "the shift REMOVES the first element."
-On page 101 a sentence which begins "If a condition IS met...". Darn. It should read "If a condition ISN'T met..." (Details, details...)
-On page 127 a phrase "cascade means that the LOWEST..." should be (Anyone? Anyone? Class?...) "cascade means the HIGHEST..."

All in all, this is just shameful stuff. If you have a quasi-morbid sense of curiosity you might want to check out the Acknowledgments section which concludes Ms. Powers's Preface. There she thanks her editor, three "tech and content reviewers", a production editor, and a copy editor. I say "quasi-morbid sense of curiosity" because, presumably, all six individuals have since been, as the British like to say, "sacked."

All that said, let us gingerly put aside, for a moment, the stupefying number of errors in this book. How does it fare otherwise? (Or, to cite a quip I just love, "Other than that, how was the play, Mrs. Lincoln?")

Well, I come now to my second major complaint. Errors and typos aside, the book is just terribly written. The organization is dreadful and her grammar is rotten. In fact, the only thing I see Ms. Powers having done well is to compiled the epitome of how NOT to write a book on programming. The two essentials of a good book on programming are that the author:
1) Organizes the material in a logical, coherent manner. A GOOD author introduces essential concepts at the very beginning, and then steadily builds upon and expands upon what the reader has just learned.
2) Takes absolutely every pain to minimize 'jumping ahead' on topics.
Ms. Powers, however, repeatedly drags the reader into complex asides before bailing out by saying "but we will cover that topic later." She does this from the get-go, and it is maddening. Here are some examples from Chapter 1 ALONE...
- In a section about cross-browser incompatibility (p.4), Ms. Powers states most of these incompatibilities "are based on differences in the underlying Document Object Model (DOM) exposed by the browser...". She then goes on for a couple of sentences about why this is so. I, for one, knew next to nothing about the Document Object Model, and I bought the book, in part, because I saw that it contained a discussion of the DOM. Ms. Powers's in-depth discussion of the Document Object Model, however, occurs in Chapters 9 and 10! She should either have made these chapters, perhaps, numbers 1 and 2, or she should should avoid mentioning the DOM until the subject is covered.
- In the section, beginning on p. 7, in which she introduces use of the <script> tag, Ms. Powers notes that this tag needs to include an attribute defining what type of script is being used. While Ms. Powers's book is, of course, about JavaScript, she duly notes that if you want to use any one of four other scripting languages the <script> tag attribute would be, say, "text/ecmascript" or "text/vbscript". I suppose this is all well and good, though it strikes me as something that could easily have been left to the end of the book. However, Ms. Powers then comes out of left field with this (p.9): "All these type values [i.e., the type of script being used] describe the MIME type of the content. MIME, or Multipurpose Internet Mail Extension, is a way to identify how the content is encoded (i.e., text), and what specific format it is (javascript). The concept arose with email, ..." Whoa! Where did the discussion of MIME come from?! Ms. Powers has not discussed MIME previously, and frankly, does not return to it for over 200 pages! In fact, as I reread this section, I found I understood the material much better simply by skipping over her discussion of MIME. To this day I don't understand MIME, nor do I want to. I imagine most novice programmers also understand little about MIME. Why bring MIME up then? IMHO, it serves only to slow down and irritate the reader.
- Later on the same page Ms. Powers goes through a discussion of how there used to be a language attribute for the <script> tag, and shows how this attribute was used to finesse the problem of writing script code that would work regardless of the browser being utilized to view one's web site. She then writes, "Eventually, though, the preference shifted to an approach called 'object detection' - a move only encouraged when the language attribute was depracated. We'll look at object detection more closely in later chapters, particularly those associated with Ajax. For now, object detection involves testing to see if a particular object or property of an object exists..." Argh!!! Once again Ms. Powers befuddles the reader. She throws out this new and confusing concept called "object detection", but then tells you she won't explain it until later in the book! It would have been much easier had she simply said something like "The language tag has been deprecated, so the approach just shown no longer works. The current method for dealing with cross-browser incompatibility will be discussed in full later in the book, in the section on Ajax." Much simpler, eh??
- As I mentioned, organization aside, the English language is an abused victim in Ms. Powers's clumsy hands. I will give just one example, from page 6. Under a subheading that Javascript can "Hide and show elements [of a web page]", Ms. Powers writes: "Based on personal preferences or user actions, show or hide page content, such as form elements, expanding writing, and changing the displayed size of an image." Huh?? Does no one at Wiley understand the concept of parallel construction? How about the concept of restrictive vs. parenthetical clauses, which in turn governs whether these clause should be - or should NOT be - offset with a comma? Heck, would ANY editor at Wiley care to take a crack at diagramming Ms. Powers's little cow pie of a sentence?

Overall, I have a vision of Ms. Powers having sat down to write her tome, and of being overwhelmed with unconnected bits of knowledge about JavaScript, and of simply rushing off to transcribe those thoughts in almost random order. Were she writing a book about driving a car, she would undoubtedly begin with a chapter about buckling up and turning the ignition key, but by the end of Chapter One she would veer off into discussions about how electrical signals travel down wires, how a rotor cap turns inside a distributor cap, and about the ratio of starter engine amps relates to engine liter size.... and would, realizing she'd gotten rather off-track, veer back each time by saying "But we'll discuss that later."
I have to admit that I never did finish the book. I TRIED! In fact, I re-started this book at least twice. I wanted to be sure that it wasn't my pea-sized brain that was the reason Ms. Powers's book is so incomprehensible. I highlighted and reviewed text. Again, I read some sections THREE times. But, my re-readings increased not my knowledge of JavaScript, but my knowledge of what a disaster the book is. On my last foray into "Learning JavaScript", I finally gave up without having even made it back to page 90.
Ummmm.... I would recommend one NOT buy this book. (At least not for reading....)