Errata

Head First Ajax

Errata for Head First Ajax

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 1
First paragraph, endorsement by Anthony Holdener

In the Advance Praise For Head First Ajax, just inside the front cover, "better approach to web design all together" should be "better approach to web design altogether".

Thomas Kennedy  Aug 26, 2010 
Printed Page 18
The line: getDetails(this.title);

On page 19 it says you can run the code from page 18 and it shows the thumbnail-detail image if you click on for example the guitar. This is not true, cause of the line getDetails(this.title);

This line referce to a function that has not been created yet and has not been mentioned prior in the book. Cause of this function the test on page 19 will fail and leave some people confused on what they did wrong.

A solution would be to either mention to add the line later in the book or mention that for the test this line needs to be commented out.

R. Bos  Nov 15, 2009 
Printed Page 37
Bottom Left - Relax - Confused about getting your server-side program working?

The section says, "Flip to Appendix I for some help on getting things working on the server".

Unfortunately, "Appendix I" (or "Appendix i" as listed in table of contents) has only 5 topics, none of which have anything to do with setting up a server to run the php pages.

I had a look at the table of contents on http://www.headfirstlabs.com/books/hfajax/ and according to that there are supposed to be 10 topics in "Appendix i".

Anonymous  Jul 10, 2009 
Printed Page 45
in the right box

The Brazilian Portuguese version of Head First Ajax, called "Use a Cabe?a AJAX" has thousands of errors. Some paragraphs doesn't make sense because of the translations errors. They changed Syncronous with Assincronous and others worse things... oh my God.... It's Terrible. But the book content is great!

Anonymous  Jun 08, 2008 
Printed Page 68/70
code samples on both pages don't match

Between pg 68 (and 67) and 70 there are differences in the code as follows:

pg 68: if (request == null);
pg 70: if (request = null);

pg 68: }else{
pg 70: else{

but both have 2 ending }, even though p68 ends one on the else line

Anonymous  Sep 19, 2008 
Printed Page 68
5th code snippet

a "}" is too much in "} else {"
or a "{" is missing at the end of the 3d code snippet
"if (request == null)"

Anonymous  Dec 25, 2008 
68
Code magnet at bottom

The code magnet that reads:

if (request == null)

should read:

if (request == null) {

The same error occurs on page 67 with the ordered code magnets.

Ian Robertson  May 21, 2009 
Printed Page 70
code block

The callback function is listed as:
"request.onreadystatechange = userNameChecked;"

In the magnets on page 67, 68, and everywhere else from the very next reference on page 73, it is listed as:
"request.onreadystatechange = showUsernameStatus;"

It doesn't look like "userNameChecked" is explained anywhere nearby.

-Nick

Anonymous  Oct 23, 2008 
Printed Page 70
if (request = null)

Chapter 2

pg 68 if(request == null)
} else {

pg 70 if (request = null)
else {

=============================
pg 68 request.onreadystatechange = showUsernameStatus

pg 70 request.onreadystatechange = userNameChecked

pg 76 showUsernameStatus

Anonymous  Oct 24, 2008 
Printed Page 79
3d action snippet

In Chapter 2, p.79 says: if a user clicks 'Register' button, the server returns an (empty) error form. However, it should never happen since this button has not been assigned to any action in the source code. So I'm confused, probably in the case of success the page thanks.html should be called, but it isn't referenced in the code...

Anonymous  Dec 25, 2008 
79
Bottom of Page

One snippets states:

An entire new page is returned
with none of the user?s information
filled in, but with an error about
the username being taken...

While another states:

Even the alert box
saying the username was taken has gone missing!

So which is it. Does the Alert box show an error stating that the username is take or is the alert box missing?

Another snippet on that same page:

It just returns a blank error page.

refers to a non existent error page. So does the text on page 79 in the printed version (the onliine page 79 had a lot of impossible to read characters on the page so I had to look at the printed version). The printed version refers to an empty error form.

There is no error form.

So to boil this down to two questions:

1. Does the alert box go away or is the error message about the username having been taken display?

2. Does the page return to the original page or to some error page?

Thanks

Anonymous  Apr 24, 2011 
Printed Page 81
First text box

Page 81 describes how to modify a status element so that an image changes as a username is validated. The page has us actually make changes to the javascript, but there is no such status element in the HTML file that comes from the headfirst website. So it is impossible to test, and nowhere in the chapter does it have us add such an element. The reason why becomes clear later, eventually we use a completely different method to achieve the goal and do not need a status element. But it is kind of confusing at first, I kept looking to see if I had missed something where I needed to add the element. In the spirit of the books approach, perhaps explain this in the next printing so poor beginners like me do not worry we goofed or missed something. Thanks!

Anonymous  Sep 26, 2008 
PDF Page 95
1st paragraph

"Also, see if you can design the site so when"
should be
"Also, see if you can design the site so that when"

Kevin  Apr 06, 2011 
Printed Page 110
bottom 3 functions

missing opening { on all 3 of the bottom functions

Anonymous  Sep 20, 2008 
Printed Page 110
6th Line of Code

Because references to images are gained using

document.getElementById("schedulePane").getElementsByTagName("img")

all images, including the logo, are allocated event handlers. Adding

if(currentImage.id != "logo")
{

}

around the event allocation code prevents the logo being allocated a useless event handler (unless of course you want to use one!)

Paracelsus  Jan 27, 2009 
Printed Page 116
var contentPane

var contentPane = getElementById("content");

should read var contentPane = document.getElementById("content");

Anonymous  Sep 20, 2008 
Printed Page 116
Next to last line

The "correct" fill-in the blank for the next to last line is shown as "getElementById"

I tried this and it did not work. Instead, I had to use

"document.getElementById"



Anonymous  Dec 14, 2008 
Printed Page 116
near bottom of page

it says:
var contentPane = getElementById("content");

should be:
var contentPane = document.getElementById("content");

Erik Holte  Feb 19, 2009 
Printed Page 116
3rd line from bottom of page

In the showHint() function, after the switch block are the lines:

var contentPane = getElementById("content");
contentPane.innerHTML = <h3> + hintText + "</h3>";

this should read:

var contentPane = document.getElementById("content");
contentPane.innerHTML = <h3> + hintText + "</h3>";

i.e. the "document." is missing from the statement and doesn't work as shown in the book.

Paul Bartels  Apr 01, 2010 
Printed Page 116
near the bottom

var contentPane = getElementById("content");
does not work. It should be
var contentPane = document.getElementById("content");

Steve Grell  Jun 08, 2010 
Printed Page 119
function showTab()

The 'if / else' block in showTab() will append 'Top.png' or
'Down.png' when creating the image sources. This is inconsistent
with the XHTML fragment on page 114, where the image source
suffixes are 'Active.png' and 'Inactive.png'

Anonymous  Dec 05, 2008 
Printed Page 119
in the code example

"Top.png" should be "TabActive.png"
and
"Down.png should be "TabInactive.png"

Erik Holte  Feb 19, 2009 
Printed Page 124
Dumb Questions, question 2 answer, second paragraph

"a#advanced.inactive means the <a> element with an id of 'tabs' and a class name of advanced"

should be

"a#advanced.inactive means the <a> element with an id of 'advanced' and a class name of inactive"

Thomas Kennedy  Aug 30, 2010 
PDF Page 127
declaration of variable in code snippet

The request variabele is scoped locally ('var' keyword). Making use of the initialized request object doesn't work in showSchedule() function.

Monkeytail  Nov 21, 2009 
Printed Page 127
Callout on line beginning "request.open" should say "beginners"

The sentence "So we need to name the fragments beginner.html, intermediate.html and advanced.html" should say "beginners.html" if it is to match the fragment supplied in the Zip file. This error is repeated in the "Get it!" box on page 128.

In fact "beginner" would make more sense in that it is an adjective like the others but the supplied fragment is called beginners.

Thomas Kennedy  Aug 30, 2010 
Printed Page 130
Middle of highlighted code block

<h3> and </h3> appear to be using escape characters and not the actual characters of < and >.

Ryan Suematsu  Aug 18, 2009 
Printed Page 135
initPage code

The initPage code shows two values for onmouseover and two values for onmouseout:

1 currentBtn.onmouseover = showHint; <--
2 currentBtn.onmouseout = hideHint; <--
3 currentBtn.onclick = showTab;
4 currentBtn.onmouseover = buttonOver; <--
5 currentBtn.onmouseout = buttonOut; <--

I think what was intended is that lines 1 & 2 be struck out.

Thomas Kennedy  Aug 30, 2010 
Printed Page 169
Mods for buttonOver (bottom third of page)

Modifications to function buttonOver():


The text says to change

this.className = "active";

to

me.classNameActivated = "active";


It should say to change it to

me.className = "active";

Anonymous  Dec 16, 2008 
Printed Page 169
Last two functions on page - a few items are switched

function buttonOver(e) {
var me = getObject(e);
me.classNameActivated = "active";
}

Should be:
function buttonOver(e) {
var me = getActivatedObject(e);
me.className = "active";
}

The following function - "buttonOut(e)" is correct

Robert McGuire  May 08, 2010 
Printed Page 183
Bottom left, text box

The box on the bottom left of the page says you can download examples that match the XHTML given on the page, but the examples on the HeadFirst site do not match the code. The code on the page 182 has a "form" element and on 183 that form is closed. The downloadable sample does not have that form element, and the printed page form refers to a "registration.php" which also does not exist in the downloadable example. Perhaps related, I noticed with the downloadable example for Chapter two that it includes a "thanks.html" file but that file is never used.

Anonymous  Sep 29, 2008 
Printed Page 183
Bottom left text box

The text says that we can download the images from from the Head First website in order for the site to work. If you download the "Mike's Movies Files" zip it does not contain the images, you have to download the finished version in order to get them. This means that in order to read/do the chapter, you have skip to the finished version.

Anonymous  Sep 29, 2008 
Printed Page 189
2nd bullet point

The 2nd bullet point says the program to check passwords has a URL of "checkPass.php" This file is not included in the example you download from Head First in order to work on the chapter, in order to get it you have to download the finished website which kind of defeats the purpose. It should come with the starter code.

Anonymous  Sep 30, 2008 
Printed Page 221
Dumb Questions, question 4

"Why do you use the parentheses" should be "Why don't you use the parentheses".

Thomas Kennedy  Sep 01, 2010 
221+224
Middle of the page

Page 221 states in more then one place that you shouldn't use parathesis when you call SetInterval, but the code on page 224 uses them. This is very confusing

Anonymous  May 02, 2011 
Printed Page 229
Thought bubble

"its time" should be "it's time".

Thomas Kennedy  Sep 01, 2010 
Printed Page 279
sample code for a win

The code in the book AND the downloaded code for the fifteen puzzle does not apply the CSS to show a win in IE 7 but does in Firefox .
Also the puzzle table looks terrible in IE 7.

Anonymous  Mar 05, 2009 
Printed Page 281
puzzle first item

skipped number 11

Anonymous  Jul 27, 2011 
Printed Page 288
bottom of the code

Just formatting - indent not consistent for id="submit" and next three lines, vs. id="currentWord"

Anonymous  Sep 06, 2011 
293
Middle of page

In the middle of the page, the word tiles.png is repeated twice. It should only appear once.

Anonymous  May 18, 2011 
393
Code after first para

The for loop should loop over 'itemDetails' variable and not some 'hero' variable!

Anonymous  Nov 21, 2010 
Printed Page 409
"sharpen your pencil

The free pornography that your book has promised at 192.72.90.234 does not seem to be available.

Douglas Calhoun  Jul 17, 2011 
Printed Page 426
In code snippet, 2nd function (emailIsProper)

The regular expression for checking email formats from Head First JavaScript is not entirely correct.

Why? What is the problem?
In the first character set ([\w\.-_\+]) the wildcard (.) metacharacter and the (+) metacharacter is escaped to get its literal meaning. As a general rule, you don't need to do anything: a metacharacter inside a character set is already escaped; you do not need to escape them again. Now there are some exceptions to this, the metacharacters that have to do with character sets:
- the closing square bracket (])
- the dash or range character (-)
- the caret or the negation character (^)
- and then the backslash (\), which of course we're using to do escaping.

The above characters typically do need to be escaped. In our case because we don't escape (-) the following email address i-love-donuts@duncansdonuts.com will not match the regular expression.

And finally in the second character set ([\w-]) the (-) character should be escaped to get its literal meaning.

The correct regular expression should look like this:
/^[\w.\-_+]+@[\w\-]+(.\w{2,4})+$/

Timea Bálint  Apr 12, 2019 
Printed Page 440
last paragraph

"less middle-of-the-night" should be "fewer middle-of-the-night".

Thomas Kennedy  Sep 05, 2010 
456
Bubble in middle of page

The word "just" was spelled jsut in the bubble that talks about adding a few lines to the register.php

Anonymous  May 29, 2011 
Printed Page 463
n/a

When discussing request headers, I suggest that you mention X-Requested-With. I think it's standard to set this to 'XMLHttpRequest', as in
registerRequest.setRequestHeader("X-Requested-With", "XMLHttpRequest);

Anonymous  Dec 03, 2009