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.

21 of 153 comments (clear)

  1. for those too cheap to buy a book by IFF123 · · Score: 5, Informative

    try this site instead:
    http://www.irt.org/index.htm
    if you need more help, you should try marketing instead.

    --
    Who took my tinfoil hat?
    1. Re:for those too cheap to buy a book by Bluetrust25 · · Score: 2, Informative

      > And [www.irt.org] is my site too!

      irt.org is a very nice site. Your javascript FAQ has saved my ass more times than I can count. It's certainly the first place I go when I have a javascript problem or just need a quick solution. Mega-kudos to you my friend.

    2. Re:for those too cheap to buy a book by mooman · · Score: 2, Informative

      Ditto on the kudos. I've taught several JavaScript classes for a consulting company and I *always* make sure the students get told about that site.

      irt.org is pretty much my *only* reference for javascript stuff other than my JavaScript Bible...

      Thanks again.

      --
      In the Portland, Ore area and like card games? Check out: http://groups.yahoo.com/group/portlandgames/
    3. Re:for those too cheap to buy a book by staypuft · · Score: 5, Informative

      You are all welcome! Just don't /. it! Bandwidth does not come cheap!

      --
      Internet Related Technologies - http://www.irt.org
  2. $4 less and free shipping! by Anonymous Coward · · Score: 1, Informative
    1. Re:$4 less and free shipping! by baldass_newbie · · Score: 1, Informative

      Get it at bookpool.com for $24.50 and don't give business to the AC.

      --
      The opposite of progress is congress
  3. Re:DHTML and javascript by pjotrb123 · · Score: 5, Informative

    Try cross-browser.com for two cross-browser DHTML Javascript libraries.
    One is complete and big, the other is more of a featherweight and a bit less powerful of course.

    --
    I liked my next sig a lot better
  4. JavaScript in a Linux Documentation Project by Anonymous Coward · · Score: 1, Informative
    The Linux Documentation Project (TLDP) is developing a prototyping authoring tool that is using a fair bit of JavaScript. If anyone is interested in volunteering/taking over development, you could check out the The LDP HOWTO GENERATOR.

    Even just a tips or suggestion to the author would be useful; TLDP is always looking for inputs to the projects and this is a recent project.

  5. A Fan of Goodman's Books by borkus · · Score: 4, Informative

    I got the first Dynamic HTML when it came out then bought the second edition and the JS/DHTML cookbook.

    The cookbook is great for newcomers to web development. It is based on common tasks, i.e. "Allowing Only Numbers (or Letters) in a Text Box". It then shows how to combine the HTML, CSS and Javascript to get carry out that task. I can't count how many times that a co-worker has asked me a Javascript question and I've shown them the answer straight out of that book. For programmers new to web development, the largest obstacle isn't HTML or Javascript syntax; it's how to put together those elements. I have yet to see a book that does it as clearly as the the JS and DHTML Cookbook. For someone starting out on their first web based projects, I'd strongly recommend DHTML - the Definitive Guide and the JS/DHTML cookbook as the best references for getting started.

  6. Save $1.18 more and free shipping by A+nonymous+Coward · · Score: 2, Informative

    I can karma whore too :-)

    Try Books-A-Million and avoid supporting Amazon patents and non-privacy.

  7. Vendor Specific by rossz · · Score: 0, Informative

    DHTML is a Microsoft creation and is not part of any recognized standard. Using it only perpetuates the ongoing attempt to control the internet through proprietary extensions.

    If you don't think this is a bad thing, then go ahead and use DHTML. While you're at it, toss in some vbs to really screw things up.

    --
    -- Will program for bandwidth
    1. Re:Vendor Specific by Anonymous Coward · · Score: 1, Informative

      Not really.

      No one has to use microsoft DOM, in fact, all vendor specific DOMS are being phased out in preference to the W3C model.

      From w3c.org:

      "Dynamic HTML" is a term used by some vendors to describe the combination of HTML, style sheets and scripts that allows documents to be animated. The W3C has received several submissions from members companies on the way in which the object model of HTML documents should be exposed to scripts. These submissions do not propose any new HTML tags or style sheet technology. The W3C DOM WG is working hard to make sure interoperable and scripting-language neutral solutions are agreed upon.

  8. Re:DHTML and javascript compatibility by borkus · · Score: 3, Informative

    The book has a compatibility legend for each recipe; most of the recipes work with IE 4 and NN 4.

    DOM support has become widespread enough that you can easily create DHTML features on a page that will work for over 99% of your visitors. The worst thing so far has been some of the positioning properties; however, some of that is due to the surfeit of properties used by IE.

  9. Example code, for free by Anonymous Coward · · Score: 4, Informative

    BTW, you can download example code for this book from here.

  10. What IS DHTML anyway? by aflat362 · · Score: 3, Informative

    I was under the impression that DHTML was just a buzzword. And that when anyone was talking about DHTML what they really meant was HTML pages with JavaScript or VBScript in them to make them do more than static HTML. Am I correct? If I'm wrong - than what the hell is DHTML?

    --

    Conserve Oil, Recycle, Boycott Walmart

  11. Re:DHTML and javascript by los+furtive · · Score: 4, Informative

    May I also recommend DOM API. They are even making an effort to make sure Safari is supported (once Apple sticks in a bloody debugger).

    --

    I'm a writer, a poet, a genius, I know it. I don't buy software, I grow it.

  12. Not Microsoft by CausticPuppy · · Score: 2, Informative

    or rather, not JUST microsoft.

    DHTML itself is not a technology... it's simply a method of using existing technologies (javascript, CSS, HTML form elements, etc) to create client-side dynamic web pages.

    Microsoft and Netscape both created implementations of DHTML which were largely incompatible with each other, leading to many programmer headaches.

    W3C is working on a standard as we speak, which is largely dependent on the standardized Document Object Model.

    More info...

    http://www.talltech.com/student/imos98student/j_ ch u/dhtml/standards.htm

    Microsoft's existing standard will be very close to the final W3C standard. Netscape's was even more proprietary because it introduced new tags that are not even in the HTML 4.0 standard (Layers, anyone?)

    --
    -CausticPuppy "Of all the people I know, you're certainly one of them." -Somebody I don't know
  13. Re:Who needs a book? by greenhide · · Score: 2, Informative

    I've used Dynamic HTML, another O'Reilly book, for some time now.

    It's a great reference, and makes it easy to look up all of the various HTML elements, CSS styles, and JavaScript objects.

    The advantage is that it's all in one place, and I can read it while it's lying on my desk, and have a text editor window open to type in my code. It's a pain to constantly switch back and forth between two windows when you're in an intensive coding session -- well, it is for me at least.

    It's like a dictionary. You can use dictionary.com (or a variant therof), but sometimes it's just easier to have the book by your side.

    That being said, there are also some excellent online resources, and it certainly makes good sense to use those as well.

    --
    Karma: Chevy Kavalierma.
  14. DHTML = Script manipulated HTML by JohnDenver · · Score: 2, Informative

    What DHTML is not

    While Dynamic HTML can be simplified as JavaScript + HTML + CSS, I can think of many instances where these technologies are use and it still can't be considered dynamic HTML.

    Ex: Using JavaScript to validate a form is not DHTML.

    DHTML - My definition

    Dynamic HTML - Any HTML content that is either dynamically created or altered by a client-side scripting language such as JavaScipt or VBScript.

    To put it simply: If you're changing the page layout on the fly, then you're doing Dynamic HTML.

    --
    "Communism is like having one [local] phone company " - Lenny Bruce
  15. Actually, DHTML is a real and specific thing by JohnDenver · · Score: 2, Informative

    I don't you followed my definition:

    Dynamic HTML is a real and valid term which covers:

    1. Dynamically creating HTML on the client.
    2. Dynamically altering HTML on the client.

    You *ARE* doing Dynamic HTML if you are using JavaScript and CSS to *DYNAMICALLY* create/alter HTML on a page.

    You *AREN'T* doing Dynamic HTML if your use of JavaScript and CSS neither creates or alters the HTML on a page.

    In conclusion: Dynamic HTML is the process of dynamically creating and altering HTML in a web page.

    (Sorry for being super-redundant)

    --
    "Communism is like having one [local] phone company " - Lenny Bruce
  16. Re:"Often with CSS"? by syncrus · · Score: 1, Informative
    Then you get into a battle of words of the meaning "dynamic", [...] As for DOM content changing, doesn't hold either. Changing DOM content was one of the first things Netscape allowed, mostly via forms. Is changing the value of a form element truly "Dynamic" HTML?
    I don't mean changin values in forms (you don't need the full power of DOM to do that), but changing anything present in a web page via the DOM model, which contains everything you can see on screen. I mean, there are wordprocessors out there programmed in JavaScript, so that content is generated dynamically. Have a look at this code:
    if (myVar == "dyn") {
    document.write('<p>Dynamic paragraph.</p>');
    }
    You can see that this <p> block may or may not appear in the webpage depending of certain condition, be it the passing of time, the content of a form, the position of the mouse... Whatever you want. That's what I mean by DOM.
    Only in the real sense of the meaning "dynamic", and not in the way it has achieved popularity, as Dynamic HTML in level 4 browser (colourfull stuff flying around).
    That would be the popular definition of dynamic content among non programmers, wouldn't it? Most people reading this are programmers/interested in programming, so we both agree that we are talking of the other dynamic meaning. Anyway... You can get flashy content via DHTML, so it could be considered a subset anyway.
    --
    To sig or not to sig.