Danny Goodman's JavaScript Handbook Support Center


Corrections

These are corrections to a few typos and other inadvertent slips that made it into the first printing of the book. I extend deep appreciation to those who have reported many of these items to me. At first look, it seems like a lot; fortunately, the problems are mostly very minor, and have been corrected in subsequent printings.

Updated Listings

Chapter 16 Calendar Listings
See
new versions that are Y2K-compliant. The applications examples in Chapters 17 through 20 seem like perennial works in progress. If you've been watching my JavaScript page, you've seen me update a couple of the applications with new features or other experiments in solidity. For the benefit of my readers, I now make it possible to conveniently download entire suites of documents for each of the applications.

Chapter 17: A Lookup Table
I haven't made any changes to this application since the book's CD-ROM went to press.

Chapter 18: Outline-Style Table of Contents
I'm proud to say that this has turned out to be quite popular among Web site designers. It has also undergone the most improvement since the CD-ROM, including better fixes for the 'reentrant window' error, support for non-linked entries, and faster redraw for outlines with more than 20 entries. One brave soul has implemented this outline with more than 300 entries! See comments at the top of the 'foodol.htm' file for the most recent additions and implementation notes.

A new upgrade prevents reloading of the outline when the user clicks on the icon of a fully nested item.

Chapter 19: Resistor Calculator
Since the version in the book, I've made two changes, one minor, one major (on 17 July). The minor one is the removal of an extraneous comment at the end of one of the select object definitions. The big one, however, may be of interest to you if you do multiple-frame windows in which one of the frames is written by JavaScript. Before the fix, a reload would cause the control frame (with the select objects) to appear in both frames. See the onLoad= event handler and associated function in rescntrl.htm to see how to work around this. Chapter 20: Decision Helper
Decision Helper has gone through some minor changes, primarily a fix to a Unix Navigator 2.0 bug I wasn't originally aware of (i.e., the document.title property is not retrievable). This required a little bit of rearchitecture in the navigation code, but nothing too serious.

What is new, however, is a version I hinted at on page 466: a version that uses fields in a zero-height frame for persistent storage, rather than the cookie. Both versions have been on my site for awhile, but here you can download the full set of files for both versions as you wish.

Appendix A: JavaScript Object Road Map (Page 486)
If you have tried to open the .pdf file from the CD-ROM to print this out, you may have encountered an unknown font complaint from Acrobat (I thought the purpose of Acrobat was to avoid this nonsense). The font issue affects only the title line of the page, not the fine print inside the boxes. Anyway, here is a copy of the file with a more standardized title font. No content has changed.

Updated Quick Reference Files

Something happened during the manufacturing process of the CD-ROM that caused the Macintosh version of the Quick Reference guide to be unreadable.

It turns out that the <FRAMESET> tag errors on pages 118 and 468 propagated to both versions of the on-line help. You can now download updated versions for both platforms.


Navigator 2.0 Scripting Notes

Here are some random things I've learned about JavaScript in Navigator 2.0x since the book went to press:

  1. Interlaced Sneak Attack (Page 355). Aside from the fact that this fooling around with comment symbols drives SGML purists up a wall, Microsoft Internet Explorer 3.0beta1 doesn't seem to like it either. Until both Microsoft and Netscape wring more bugs out of their beta browsers, however, I will not change the pages that work fine under Navigator 2.02. That includes my main JavaScript page.
    Headline: Platform wars resume! Casualties mount!

  2. "Script1.htm" on the Mac. Don't be alarmed if you are running Navigator on the Mac and get a date in 1926 to appear in your first script (Chapter 3). The document.lastModified property expects the "server" to deliver file date information to it in particular formats that don't seem to match the way the MacOS hands back the info. If you were to put script1.htm on your own server, it would likely supply the correct date. Even so, not all Web servers dish up the date in the proper format, no matter what platform of Navigator you're using.

  3. Creating Arrays. There is another word in the JavaScript language that makes it a little easier to create a new empty array (page 261). Instead of having to supply an array constructor function, you can create a new array object like this:

    var newObj = new Object()

    After that, you can populate entries of the array just like the type of array you'd make with a constructor:

    newObj[1] = "Fred"
    newObj[2] = "Elaine"

    If you want to assign a length property, then you still must do it manually until Navigator 3.0 gives us true array objects that track their sizes dynamically on their own.

  4. click() Methods. While I recommend not using these methods throughout the book, it turns out that they don't work at all in Navigator 2.0x. No wonder I couldn't see any value to them!

  5. Date object errors on Macintosh. On page 288, I talk about one Date object method causing the Macintosh to increase the value of the date object by one day. This affliction affects the Macintosh for every Date object method.

    When I have a date-centric application, I start the script by setting a global variable with the offset value as determined by JavaScript:

    var now = new Date(0)
    var dateAdjustment = now.getTime()

    For non-Mac Navigators, this comes to zero (except for Navigator 2.0 and 2.01 for Windows 3.1--an internal bug triggers a bogus 'divide by zero' script error), so it is now safe to subtract this dateAdjustment value (which is in milliseconds) from any date object prior to invoking a date method.

  6. document.title Property. In Navigator 2.0, the document.title property does not return any values on many Unix platforms. If your site relies on obtaining the document.title property to assist in navigation (as my Chapter 20 Decision Helper app did), then look for another way to determine the currently loaded document. For example, you can set a global variable value in each of your related documents containing the title string that is important to your navigation scripts.


Navigator 3.0 Tidbits

Navigator 3.0's new JavaScript features:

  1. A New JavaScript Roadmap. This version is the final version for Navigator 3.0.

    If you liked the object roadmap on page 486, then you'll love the new one for Navigator 3.0. With so many more objects and new properties, I've had to expand its size a bit. The new file is an Adobe Acrobat (.pdf) file, ready for display or printing through Acrobat or Adobe's Acrobat plug-in.

    The roadmap prints on two sides of an 8-1/2 x 11 inch page (A4 users, try the Shrink to Fit choice in the Print dialog). Print page 1 from your paper tray; print page 2 manually. The result is a nice little folding reference for JavaScript's objects (their properties, methods, and event handlers). New items for Navigator 3.0 are marked. Download roadmap .pdf file now (12K).

    Interested in the latest developments for Netscape Communicator? The Object Roadmap has been updated for this latest Netscape offering. It is a .pdf (Adobe Acrobat) file that prints out on both sides of two pieces of paper and folds into a convenient reference. The new version shows Navigator and Internet Explorer compatibility ratings for every Netscape Navigator object and its properties, methods, and event handlers. I use it all the time.
    If you have the Acrobat reader plug-in, you can preview the entire document. Or download your choice of a Windows zipped version or Macintosh binhex version. The download versions include step-by-step instructions for printing, assembling, and folding the pages into a handy pamphlet format.

  2. A New JavaScript Help Files. Here are the WinHelp and Apple Guide quick reference files updated for Navigator 3.0.

  3. The release version of Navigator 3.0 is now available to the public at the usual places.

  4. What to do about Navigator 3.0 bugs. Now that the betas are over, any scripts that worked in 2.0x but don't in 3.0 need attention. In many such cases, Navigator 3.0 has tightened up on its syntax, so ultimately getting scripts to work in 3.0 (without any new features) should also have them humming in 2.0 (plus-or-minus platform-specific bugs).

    It's a nasty business for some page authors, I know, but the scripts from my JavaScript pages have been running quite smoothly in Navigator 3.0 without modification from their 2.0 incarnations: It is possible to have it both ways!