Product Overview

The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks

Corrections & Typos

Found a mistake that’s not listed here? You clever monkey! Contact us to let us know!

  • No known errors at this time

Confirmed typos in the December 2006 reprint:

  • p.9 2nd code listing
    Both calls to changeBorder should pass this as their first argument.
  • p.41 4th paragraph
    In fact, isNaN will return true for any value that cannot be converted to a number.
  • p.98 code listing
    inputs.getAttribute should be inputs[i].getAttribute.
  • p.119 code listing

    The spaces before the $ characters in the regular expressions should be removed. For example:

    /(^| )checkRequired( | $)/
    should be
    /(^| )checkRequired( |$)/
    .

  • p.232 last paragraph
    mybutton should be mylink.
  • Chapter 15 examples

    You may find the vertical and horizontal drop down menus don't work as expected in IE7. The book was originally published before IE7 was released but the author, James Edwards, has supplied this CSS fix for the vertical menu:

    /* 20080221: new hacks for IE7 */
        *+html ul.vertical li {
            display: inline; 
            float: left; 
            background: #fff; 
        }
        *+html ul.vertical li { position: static; }
        *+html ul.vertical a { position: relative; }

    Here's the fix for the horizontal menu

    /* 20080221: new hacks for IE7 */
        *+html ul.horizontal li {
            display: inline; 
            float: left; 
            background: #fff; 
        }
        *+html ul.horizontal li { position: static; }
        *+html ul.horizontal a { position: relative; }

Confirmed typos in the August 2006 reprint:

  • p.92 code listing
    Both occurrences of paragraphNode should be paragraph.

Confirmed typos in the February 2006 First Edition:

  • p.7 paragraphs 2 and 3
    The phrases "The above approach..." and "This scripting approach..." relate to the code listing on the previous page, not the one on this page.
  • p.15 code listing 2
    There is a missing } following line 9 (documentAddEventListener...).
  • p.37 code listing 1
    There shouldn't be quotes around 10 on the first line.
  • p.53 paragraph 5
    b[0] though b[4] should be d[0] though d[4].
  • p.83 paragraph 3
    anchorArray[0] through anchorArray[3] should be anchors[0] through anchors[3].
  • p.138 code listing 1
    The first else if line should also check if scrollLeft is greater than zero:
    else if (typeof document.documentElement.scrollTop
        != 'undefined' && (document.documentElement.scrollTop > 0 ||
        document.documentElement.scrollLeft > 0))
    {
  • p.198 code listing 1
    else if (agent.indexOf("mac")) should be else if (agent.indexOf("mac") != -1).
  • p.232 paragraph 1
    button.onclick should be mylink.onclick.


ebook only

Instant Download!
This title available in Adobe PDF, Kindle (mobi) and ePub (IOS) formats

SitePoint Books

  • advocate best practice techniques
  • lead you through practical examples
  • provide working code for your web site
  • make learning easy and fun

100% Money Back Guarantee