Errata

Javascript: The Definitive Guide

Errata for Javascript: The Definitive Guide

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 97
end of paragragh that begins with "In other words"

The last word should be changed from "operators" to "operator".

Anonymous   
Printed Page 156
5th paragraph

The line:
"a = new Array(10); // a.length == 10 (empty elements 0-9 defined)"
Should be:
"a = new Array(10); // a.length == 1 (element 0 defined)".

This is what happens using NN 6.0.
This implies that the 6th paragraph on pg 154 is also wrong..ie,
"var a = new Array(10);"

Anonymous   
Printed Page 158
first two lines under "9.2.1 join()"

converts all the elements of an array to a string and
concatenates them

should be changed to

converts each array element to a string and concatenates
the resulting strings

Anonymous   
Printed Page 160
last paragraph (above example code)

"no elements are" should be "no element is".

Anonymous   
Printed Page 169
2nd paragraph of section 10.1.4

The final sentence of this paragraph in the 3/00 print reads:

And /(ab|cd)+|ef)/ matches either the string "ef", or one
or more repititions of either of the strings "ab" or "cd".

The initial error appears to be (to quote emacs): "mismatched set of
parentheses":

/((ab|cd)+|ef)/

It appears that either way, the code will match correctly, but it's generally
a good idea to group properly by matched sets of parentheses.

Anonymous   
Printed Page 215
3rd paragraph

The statement must include 'LANGUAGE' --
it is shown as:
<SCRIPT SRC="../../javascript/util.js"><SCRIPT>
This statement does not work.

To make it work it should include 'LANGUAGE' --
<SCRIPT LANGUAGE=JavaScript" SRC="../../javascript/util.js"><SCRIPT>

Anonymous   
Printed Page 220
code

This code is incorrect

<!--&{navigator.platform =3D=3D "win95"};
<SCRIPT LANGUAGE=3D"Javascript">
... // Javascript code
</ SCRIPT>
- --->

"win 95" should be "win32".

More seriously, if {navigator.platform =3D=3D "win95"} is a = Javascript
function that needs to be inside <SCRIPT LANGUAGE=3D"Javascript">=20. So the
code should be thus:

<SCRIPT LANGUAGE=3D"Javascript">
<!--&{navigator.platform =3D=3D "win95"};
... // Javascript code
- --->
</ SCRIPT>

Anonymous   
Printed Page 259
second paragraph of subsection 14.1.2

To alleviate a confusing antecedent situation, I recommend changing
"attributes like onClick and onMouseOver of HTML elements" to "HTML-element
attributes such as onClick and onMouseOver".

Anonymous   
Printed Page 302
2nd paragraph

"Invoking the submit() method of a Form submits the form, exactly as if the
user had clicked on a Submit button...." disagrees with the Form.onsubmit
description on page 512.

As far as I can tell, the Form.onsubmit description is correct when it says
that the Form.onsubmit() method DOES NOT GET CALLED if form.submit() is called
directly.

This is a potentially significant difference between pressing a Submit button
and calling Form.submit().

Anonymous   
Printed Page 313
last section, defining the error msg

There are too many lines for viewing in the Netscape Alert box. Eliminate all
but the first defining line of msg. I.e., replace

msg = "______________________________________________________

"
msg += "The form was not submitted because of the following error(s).
";
msg += "Please correct these error(s) and re-submit.
";
msg += "______________________________________________________

"

with the single line:

msg = "Please correct these error(s) and re-submit.
";

Also, there are numeric errors. Min and max are not displayed as scripted.
Replace

if (empty_fields) {
msg += "- The following required field(s) are empty:"
+ empty_fields + "
";
if (errors) msg += "
";
}
msg += errors;
alert(msg);
return false;
}
</SCRIPT>

with the following:

if (empty_fields)
msg += "- The following required field(s) are empty:
"
+ empty_fields + "
";
if (errors) {
msg += "
";
msg += errors;
}
alert(msg);
return false;
}
</SCRIPT>

[example 13.5] per the online except from ch13: example 13.5;
the code parses based on comma separated arguments,
but URLs use ampersand as separator characters.

Anonymous   
Printed Page 327
5 lines from bottom

This is part of the DynEl.js cass listing. When I attempt to run it under
Netscape I get a message that "this layer has no properties" at line 83 of the
program (downloaded from your web site).

Anonymous   
Printed Page 363

The figure on p.363 has a box in the JavaScript column containing
'string' and 'netscape.javascript.JSObject'. This is an error since
script code never has netscape.javascript.JSObject objects (this is a
Java class, after all). This Java class exists only in Java and is used
to wrap JavaScript objects. If such an instance is ever passed back to
JavaScript, then it is unwrapped and the original JavaScript object is
passed to JavaScript instead.

(I suppose this has gone unnoticed since not too many people are
implementing LiveConnect in their browsers -- I'm working on
implementing it for OmniWeb 4.1 for Mac OS X --
http://www.omnigroup.com/)

Anonymous   
Printed Page 457
Date.setDay() Object is not mentioned or documented. All other

Date.set*() objects are documented, but the Date.setDay() is not.

Anonymous   
Printed Page 465
second paragraph after Description

The English expansion of UTC is (Coordinated Universal Time), not (Universal
Coordinated Time). This bug may appear elsewhere in the book.

Anonymous   
Printed Page 512
the book mentions about returning false from an onSubmit to

stop a form submission. Per the Microsoft Website:

"If the event handler is called by the onsubmit attribute of the form
object, the code must explicitly request the return value using the return
function..."

so instead of just calling

<form ... onSubmit="handler" ... >

you need to call

<form ... onSubmit="return(handler)" ... >

The URL for the above info is
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onsubmit.asp?frame=true

Anonymous   
Printed Page 627
middle of page, second code example

The code fragment:

value = 1234;
binary_value = n.toString(2);

should probably read:

value = 1234;
binary_value = value.toString(2);

or alternatively:

n = 1234;
binary_value = n.toString(2);

for it to make sense and match up with the previous code example.

Anonymous   
Printed Page 730
last paragraph

IE 5.0 and Communicator 4.72 behave in the opposite manner. I don't have any
older versions of the browsers. The frameset onunload handler is invoked
before the frames' onunload handlers.

All Javascript documentation I can find describes this the same way you
documented it. Everyone agrees it should work that way, but it doesn't!

Anonymous