Product Overview

DHTML Utopia:
Modern Web Design Using JavaScript & DOM

Corrections & Typos

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

first edition, november 2005 update

  • p.132 code block The line return = null; should read return null;.

Confirmed typos in the November 2005 reprint of the first edition:

No known typos.

Confirmed typos in the May 2005 1st edition:

  • p.3 footnotes
    http://ww.w3.org/TR/html4/ should be http://www.w3.org/TR/html4/.
  • p.9
    TextPad isn't free; only a free trial is available.
  • p.29 code listings 3 and 4
    newpara.firstChild will actually give a text node--the whitespace between the <p> tag and the <a> tag. Instead, this should be:
    newpara.getElementsByTagName('a')[0].removeAttribute('id');
  • p.29 code listing 5
    An id attribute is missing from the first Yahoo! link:
      <p id="codepara">
        <a href="http://www.yahoo.com/" id="yalink">Yahoo!</a>
        <a href="http://www.linux.org/">The Linux operating system</a>
      </p>
  • p.38 code listing 2
    Missing () after toLowerCase.
  • p.44 paragraph 3
    The sentence "The event handler is the location at which an event handler is placed." should read "The event target is the location at which an event handler is placed."
  • p.57 code listing 1
    The window.event.cancelBubble check is redundant. The first line of this code listing should actually just be:
    if (window.event) {
  • p.57 code listing 2
    The window.event.returnValue check fails in Internet Explorer, which gives this property a value of undefined by default. Since the check is practically redundant anyway, we can adjust the code to avoid this issue:
    if (window.event) {
  • p.61 code listing 2
    Missing from this code listing is the check to confirm that the link element was found. The lines in bold were incorrectly omitted:
    while (el.nodeName.toLowerCase() != 'a' &&
        el.nodeName.toLowerCase() != 'body')
      el = el.parentNode;
    if (el.nodeName.toLowerCase() == 'body')
      return;
          
  • p.70 code listing 1
    As explained on p.71, the following line is incompatible with current versions of Safari (1.3 and 2.0):
      var ci = el.cellIndex;
    This line must be replaced with the following code:
      var ci = -1;
      for (var i = 0; i < parent_row.cells.length; i++) {
        if (el == parent_row.cells[i]) {
          ci = i;
        }
      }
      if (ci == -1) return; // this should never happen
    The code archive has been updated with this correction.
  • p. 90 code listing
    The capitalisation of the variable my in the first if block should be mY.
  • p.121 code listing
    The line beginning with rH.links is incorrect. Should be:
    rH.links = navList.getElementsByTagName('a');
  • p.128 paragraph 3
    "the [- 0-9] section means" should be "the [- ()0-9] sections means".
  • p.134-135 code listing
    This code listing is inconsistent with the fragments shown subsequently, as well as the code archive. It uses the DOM standard nodeValue method to modify the text of the page, which as noted in the footnote on p.135 is incompatible with Safari. Here is the corrected code listing:
    checkValid: function(e) {
      var target = window.event ? window.event.srcElement : e ?
          e.target : null;
      if (!target) return;
    
    
      var failedE = fV.handleValidity(target);
    
    
      var errDisplay = document.getElementById('error_' +
          target.name);
    
    
      if (failedE && errDisplay) {
        errDisplay.innerHTML =
            validationSet[failedE.name]['error'];
        failedE.focus();
      }
      if (failedE && !errDisplay) {
        alert(validationSet[failedE.name]['error']);
      }
      if (!failedE && errDisplay) {
        errDisplay.innerHTML = '';
      }
  • p.227 onward
    The Sarissa library has been updated since the release of this book. If you wish to use the current version, rather than the older version distributed in the code archive, you'll have to make some changes to the scripts in this book to accomodate a significant change to the API. Specifically, to create an XMLHTTP object, you can no longer user Sarissa.getXmlHttpRequest(). Instead, you must use the Mozilla-style new XMLHttpRequest() constructor:

    var xmlhttp = new XMLHttpRequest();

    This change affects the code on pages 227, 233, 244, 259, 263, and 302 of the book.

    If you received the DOM & JavaScript Quick Reference Guide poster with your copy of DHTML Utopia, you may wish to update the poster with this change as well.

  • p.142 code listing 2
    p.146 code listing

    The checkSubmit method is used to prevent the browser from submitting the form when validation has failed in Safari browsers. But because Internet Explorer processes event handlers (like checkSubmit) before event listeners (like checkValidSubmit), as written it will prevent the form from submitting when the previous form submission attempt failed due to a validation error. To correct this, we must always return true from checkSubmit in IE:
      checkSubmit: function() {
        if (this.attachEvent) return true;
        return this.submitAllowed;
      },
        
  • p.284 paragraph 1
    The first sentence of this paragraph should read "Thisis the first practical example we've seen of JavaScript exception handling (not event handling or error handling) since introducing the technique in Chapter 5."



Instant Download!
This title available in Adobe PDF format only

Special Bonus

Bonus $9.95 JavaScript & DOM Poster!

FREE with every purchase of ‘DHTML Utopia: Modern Web Design Using JavaScript & DOM’ made through sitepoint.com

DOM Poster

Features:

  • Large, ‘speed-browse’, format (17" x 24")
  • Lists all the most commonly-used Core JavaScript, Style Properties and Browser Objects
  • Features an intuitive ‘Document Object Model’ diagram
  • Provides handy, reusable AJAX and Event Handling syntax
  • Is ONLY available while stocks last
Take a look »

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