Slashdot Mirror


JavaScript and DHTML Cookbook

Adios077 (Ada Shimar) writes "Ok, so I was reluctant when I first picked up and started reading O'Reilly's JavaScript & DHTML Cookbook. After all, I'm fairly proficient in JavaScript already (yes, get in line to hire me!), and if I needed some cool DHTML scripts, I could just visit a good site like Dynamic Drive. However, the book managed to both surprise and impress me, a great combination to have in a book." Find out why by reading the rest of Shimar's review, below. JavaScript and DHTML Cookbook author Danny Goodman pages 576 publisher O'Reilly & Associates rating 8.5 reviewer Ada Shimar ISBN 0596004672 summary A surprisingly useful JavaScript book, even for people skilled with the language already.

I'll begin my review by making a bold statement -- if you've read and like O'Reilly's Definitive Guides on JavaScript and DHTML, you'll adore this book. I use the word adore very deliberately here, because in my opinion JavaScript & DHTML Cookbook is much easier to love than the gigantic and sometimes monotonous Definitive Guide series. Why, you ask? Let's see -- the book is compact (some 500 pages), concise, and filled with the essence of JavaScript and DHTML as far as what you can create using the language/ technology.

JavaScript & DHTML Cookbook is broken up into 15 chapters, each containing a series of recipes. The chapters are:

  1. Strings
  2. Numbers and Dates
  3. Arrays and Objects
  4. Variables, Functions, and Flow Control
  5. Browser Feature Detection
  6. Managing Browser Windows
  7. Managing Multiple Frames
  8. Dynamic Forms
  9. Managing Events
  10. Page Navigation Techniques
  11. Managing Style Sheets
  12. Visual Effects for Stationary Content
  13. Positioning HTML Elements
  14. Creating Dynamic Content
  15. Dynamic Content Applications

These chapters are used mainly to facilitate the look up of a particular recipe, as each recipe exists and is explained independent of one another. This is consistent with the style of most Cookbooks, and it seems to work well here as well.

If you're a complete novice, you may be wondering at this point the distinction between JavaScript and DHTML. The book doesn't make a conscious effort to differentiate between the two when discussing recipes, and for a good reason. DHTML is basically JavaScript, though the latter draws in your page's HTML and often CSS as well to create something more encompassing.

Ok, on to what's important now -- the recipes themselves. I was expecting a series of flashy, long and tacky JavaScripts you can find in the source of every other site on the web these days, padded with some nonsense accolade like "the web cannot survive without them." Such scripts are mostly counterproductive, and do little to educate a JavaScript learner, let alone a master like myself (hur hur). To my delight, things were the complete opposite. The recipes in JavaScript & DHTML Cookbook are extremely practical, well thought out, and even educational. Discussions like Calculating the Number of Days Between Two Dates, Simulating a Hash Table for Fast Array Lookup, and Transforming XML Data into HTML Tables not only are very useful to the cut-and-paster, they teach even seasoned JavaScripters a thing or two about the language.

The only minor compliant I have with this book is the length of some of the script examples -- they span a little too long to follow effortlessly. The longest script I can recall in the book runs about 5 pages in length. Fortunately, such recipes are few and far in between, and 95 percent of the recipes are extremely short in length and packed with useful information and techniques. For the long scripts, it's easy to see that they exist out of necessity to create and show a fully functional script rather than just to pad pages.

In summary, I walk away from reading JavaScript & DHTML Cookbook with many new tricks up my sleeve, something I had not expected at all. Some good resources online that compliment the reading would be DevEdge's JavaScript Reference and JavaScriptKit's JavaScript tutorials."

You can purchase JavaScript and DHTML Cookbook from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

8 of 153 comments (clear)

  1. DHTML and javascript by ximor_iksivich · · Score: 5, Insightful

    DHTML and javascript make an excellent combination for displaying animated content.. but the question of browser incompatibilty still remains... What we need is a book for making browsers compatible first then have lots of books on the ways to use them... seems logical to me anyway :-)

    1. Re:DHTML and javascript by On+Lawn · · Score: 2, Insightful

      I don't think "can" has been the question as much as its so plain annoying. I'm sure plenty of people could provide commentary on the issues of portability of code in browsers vs OS's and computers.

      Language portability happens in C all the time, and is managed through a number of very difficult tools. In Javascript, it does it in runtime, figuring out its environment and adjusting which routines will run dynamically. In Java the environment provides the portability.

      Portability is a worth-while goal in that it provides freedom. But is it too much to ask for a Javascript's portability to be pushed from run-time to handled by the environment? It shouldn't be a question of diversity of environments and a willingness to stop trying to screw each other over. Thats all.

      Not to rant on your comment, you just brought up a pet peeve of mine.

  2. Re:for those too cheap to buy a book by staypuft · · Score: 4, Insightful

    LOL - Where are the moderation points when you need them!

    And it is my site too!

    --
    Internet Related Technologies - http://www.irt.org
  3. Re:$4 less and free shipping! by wzm · · Score: 1, Insightful

    It seems to be, usually with a follow up post that a different site has it even cheaper then Amazon. I'm curious as to how frequently the ACs involved have some sort of referal system going on, and how that effects the posts rating. Do people usually rate such comments more poorly, or does no one notice/care? If they/you do rate it lower, why? Do you rate other people lower when they are advocating something they have a financial interest in, and if so why are celebrities exempt, such as John Carmack?

  4. Re:$4 less and free shipping! by greenhide · · Score: 2, Insightful

    Ha ha...See postings above to see irony in the -1 offtopic mod. The guy who gives the amazon post is modded as informative -- gee, who woulda thunk it? "Amazon is selling an O'Reilly book", now that's informative -- and trying to make money off of it too. This last post, which offers a much better retailer (in terms of price), is modded as offtopic. My suggestion? Don't mod these kinds of comments at all. Everyone knows that you can buy books at online retailers.

    At least, don't mod them until they create the

    +1 Offered Lazy Asses Like Me the Link

    moderation.

    --
    Karma: Chevy Kavalierma.
  5. Re:You know the world has changed... by jpkunst · · Score: 3, Insightful

    Most O'Reilly books are actually less voluminous than comparable computer books from other publishers.

    JP

  6. What problem? by djeaux · · Score: 2, Insightful
    BTW, can anyone spot the problem with this code:

    Sure can. You redefine the variable i. Departing radically from /. convention, I actually pasted your code into my trusty text editor to see if there was some cool trick that I didn't notice just reading it & found that it behaved exactly as I expected:

    1. myfunc1() passes 0 (zero) to myfunc2() on the first iteration of the myfunc1 loop.
    2. myfunc2() then increments i stepwise to 14 whereupon it returns to myfunc1() & ends because 14 > 10.
    In fact, this same code (with slight syntax changes) produces the same result in Perl unless 'i' is localized in each function & the value passed to myfunc2 is handled as @_. I'm pretty certain the result would also be the same in C, but here I bow to laziness & /. norms. In fact, I would regard a different outcome as a "problem". :-D

    Are you trying to illustrate the sloppy code that happens because JavaScript is easy & free & a bunch of folks with no concept of good coding practice can just kludge away? Or is there something more substantive to the example?

    --
    "Obviously, I'm not an IBM computer any more than I'm an ashtray" (Bob Dylan)
  7. Re:Not JavaScript!!! by SCHecklerX · · Score: 3, Insightful
    My favorite javascriptism is using + as both a numerical addition and a string concatenator, which, of course, is all kinds of fun in a language where you don't type your variables:

    a = 1 + 4 would yield a = '14'. Irritating.