JavaScript Bible (Gold Edition) Support Center

CD-ROM Index

Changes to the innards of Netscape 6.1 and later prevent the index.html file located in the Author-Files/Listings directory on the CD-ROM to work properly with those browsers. I have reworked the index file so that it utilizes dynamic table updating in IE4+/Windows and NN6+. All other browsers continue with the old scheme of a dynamic frameset. There is some interesting scripting there for you to enjoy. If you have copied the Listings directory to your local hard disk, download the new version, and use it instead of the original index.html page as your gateway to the hundreds of listings.

Corrections & Updates

Corrections or changed information for the first printing (corrections will be incorporated into subsequent printings, so not all of the following items may apply to your copy of the book):

  • Page 30. The hidden input element is missing from Figure II-1. That element has been scriptable since Day One, although there obviously are no event handlers for it. But you can use scripts to set the value property to modify data submitted with the form behind the scenes.
  • Page 59. In the fourth full item about control structures, the do-while and switch constructions were inaugurated with JavaScript 1.2. The browser versions shown there are correct.
  • Page 67. Ignore the last three paragraphs of the upper part of the page. The onload() function technique no longer works in a lot of browsers.
  • Page 73 (Figure 14-2). Due to a production snafu, the vertical line extending from the bottom of the "document" box to the next lowest horizontal line is missing. You can see the correct version of Figure 14-2 on the back page of any of the booklet versions of the Quick Reference PDF files on the CD-ROM.
  • Page 77. Typo in paragraph two of the "DOM levels" section. The third word of line four should be plus, not plug.
  • Page 110. Typo in the "Related Items" section. The method name should be scrollIntoView().
  • Page 111. The attributes property, as noted, returns an array of attribute object references. IE 5 and 5.5 for Windows has a sloppy implementation of that object, so if you use The Evaluator to explore this property of, say, the table element (as suggested in Appendix F), a few of the attribute values are out of whack. IE 6, however, does it right, as does NN 6 and IE 5 for the Mac. In any case, the canonical way to read/write the value of an attribute is through the element's getAttribute() and setAttribute() methods.
  • Page 114. The compatibility chart for childNodes should read IE 5 and IE 5.5.
  • Page 132. Discussion about the shared nextSibling and previousSibling properties incorrectly speaks in terms of sibling elements, when in truth these properties reference nodes. In the example shown on this page, the EM element has both a previous and next sibling -- both of which are text nodes of the P element.

    On a related subject, Netscape 6 and later treat source code white space (e.g., carriage returns) as text nodes. For example, if you format your source code like this:

       <DIV>
       <P>...</P>
       </DIV>

    the P element has both a previous and next sibling in Netscape 6+. Those sibling nodes are text nodes, each containing a single carriage return character. IE, on the other hand, ignores carriage return whitespace, and would report that the P element has no sibling nodes.

    This Netscape treatment of whitespace is a controversial subject. One could argue (interpret the W3C standards) that these whitespace text node siblings are correct. But for scripters, they get in the way, forcing you to verify the nodeType of a sibling to find adjacent elements. You can see the disparity of node treatment by invoking the walkChildNodes(document.body) function in The Evaluator under IE and NN6+.

  • Page 155. Clarification: the attachEvent() and detachEvent() methods are not supported in IE5/Mac.
  • Page 175. By way of clarification, the insertBefore() method returns a reference to the node that has just been inserted; also, if the node referenced in the parameter is an existing node from the document tree, the existing node is removed from its original place, and inserted where directed by the insertBefore() method.
  • Page 185. The last sentence of paragraph 3 (for the replaceChild() method) should read:
    "If you simply want to change an element, you can do so more directly in IE5+ with the swapNode() or replaceNode() method."
    The W3C DOM provides no direct method for replacing an element from the point of view of that element -- only from its parent.
  • Page 197. In the subject of the first line should be "The event model in IE4+..."
  • Page 209. The IE-only code example for the assureUpper() function should be using the event.keyCode property in all instances.
  • Page 219. In Figure 16-2, the text inside the two boxes of the middle row should read Child Frame.
  • Page 243. At the bottom of the page, the trailing "e" is missing from "Read/Write".
  • Page 267. The entry for window.open() mentions the optional replaceFlag parameter, but doesn't describe what it does. This IE-only parameter is a Boolean value, but Microsoft's description of what it does makes no sense to me, and its observed behavior is counter-intuitive. Here's what I see with IE5.5/Win98 with a name assigned to the second parameter of the open() method, and that method invoked repeatedly with different URLs, but everything else the same: 1) with the replaceFlag value set to true, a new window opens for each invocation of the method; 2) with the replaceFlag value set to false, the window created by the first invocation of window.open() has its contents replaced by the new URL, and I am left with only one subwindow.
  • Page 269. In Table 16-3, the description of the top property should start with Vertical position
  • Page 273. In the last paragraph on the page, delete the parenthetical comment at the end of the first sentence. The behavior is the same for Netscape and Internet Explorer browsers.
  • Page 285. The last statement of the findAndCycle() function is missing some important single quotes, as follows:

      intervalID = setInterval("cycleAnimation('" + elemID + "')", 500)

    These single quotes force the string value of elemID to be treated as a quoted string when the cycleAnimation() function fires in 500 milliseconds.

  • Page 288. In the second paragraph of the description, the fourth line is missing an "s" on the property name: window.dialogArguments.
  • Page 353. The link to Bill Dortch's web site is no longer valid. He seems to have disappeared. If anyone has current contact information, please let me know.
  • Page 371. The last sentence of the links property description means that you have the same properties available to each member of the links array as for the location object.
  • Page 391. In the syntax for the document.open() method, the second parameter is not a placeholder, but a constant: replace.
  • Page 459. In the big table, the fourth item in the lefthand column should read InsertUnorderedList.
  • Page 489. The SCRIPT.src property is read/write, but only IE actually loads a different .js file into the page when you assign a new URL to the property. IE doesn't exactly remove all pieces of the original .js file, but if the new file uses the same variable or function names as the original file, the new versions overwrite the same-named items from the original file.
  • Page 513. The descriptions of the hspace and vspace properties have their orientations reversed. hspace controls the left and right margins; vspace controls the top and bottom margins. I must have been hypnotized by The Outer Limits on TV as a kid.
  • Page 538. Delete the word "they" from the end of the first line of the first full paragraph.
  • Page 553. Only the <input> type of button (and not the <button> element) submits the value attribute value with the form. A <button> element submits the element's content (the string between the start and end tags) with the form. If you provide multiple submit buttons for a form, and want some button-specific data submitted with the form, use the onClick event handler to assign the data to a hidden input field prior to submission.
  • Pages 605. The IE-only add() and remove() methods belong to the options array object, and not individual option element objects, as indicated. The working example in Listing 26-2 demonstrates the correct usage.
  • Page 735. Near the bottom of Table 29-2, the NN6 implementation of the cancel bubble action is stopPropagation(). Netscape also implements the IE cancelBubble property, but that property is not part of the W3C DOM Event model. The preventBubble() method was an older, preliminary implementation that I failed to replace in this table when Netscape and the W3C DOM finalized their syntax.
  • Page 740. Table 29-4 should include the dblclick event type, which is implemented in IE4+ and NN4+ (continuing into NN6+).
  • Page 741. Table 29-4 should not include the scroll event type, which is implemented only in IE4+.
  • Pages 768-9. The IE event.x and event.y properties operate within the coordinate system of the event target's offsetParent element only when the offsetParent is a relative-positioned element. By coincidence this offsetParent coordinate system also holds true for an absolute-positioned element that is a child of the body element (in non-standards-compliant mode) because the body is the offsetParent. But the intention of these two properties is to work within a relative-positioned offsetParent space.
  • Pages 768-9. Netscape 6+ has a peculiarity with respect to the values returned by the layerX and layerY properties of the event object. If the event target is a text-based form control (text input element, textarea, or select), the coordinate system for the two properties is confined to the element itself, even if the element is not positioned. This could bite you if you track the location of mouse events in these form controls (probably a rarity) via the layerX and layerY properties (an even rarer probability).

  • Page 774. The last sentence of the preventDefault() description should read: "Invoking the preventDefault() method in NN6 is the equivalent of assigning false to event.returnValue in IE4+."
  • Page 960. The middle code example for the random number statement (it's actually a pseudo-random number generator) should be as follows:

    Math.floor(Math.random() * (n - m + 1)) + m

    where n is still the top number of the range and m is the low number of the range. When the bottom of the range is 1, you can short circuit part of the expression, as shown in the third example for the roll of a die.

  • Page 962. In the first paragraph under NEGATIVE_INFINITY, the last line should list only two values (an extra comma throws things off). The values are 1.7976931348623157 * 10308 and 5 * 10-324.
  • Pages 972-3. In Table 36-1, the descriptions for the getMilliseconds() and getUTCMilliseconds() methods are not correct. These methods return the number of milliseconds (0 to 999) following the next lowest full second of the date object instance. In other words, if you created a date object exactly between 00:00:00 and 00:00:01, the value returned from both methods would be 500.
  • Pages 1023-1029. Let me clarify some things about the multiline property and what the whole "multiline" thing means in JavaScript regular expressions.

    Although Netscape 4+ implements a multiline property for the RegExp static object, that is not normal, and is not supported elsewhere. Such a property is not part of the ECMA standard (as correctly stated on page 1029). The only place the property should be read is from an instance of a RegExp object.

    The value of the regexp's multiline property is determined exclusively by the presence or absence of the 'm' flag in the object constructor (it's another flag just like the 'g' and 'i' flags). In other words, the scripter determines whether the multiline property of the regexp object will be true by explicitly setting the 'm' flag, as in:
       var re = /you/gm;
    After the above statement executes, re.multiline is true.

    Now, what does setting this flag mean? First of all, its importance is _very_ limited. Despite its name, the 'm' flag has no bearing on the search for text matches extending across multiple lines of text in a string. All searches work across multiple-line strings. Period.

    The 'm' flag does apply, however, when the regular expression includes the ^ or $ symbols. For example, let's look at the ^ symbol, which indicates that the pattern must start at the beginning of a string. Here are some examples, using the multiline string:
       Are\n
       you\n
       happy?
    The regexp /you/ will find a match because the pattern "you" is someplace within the string.

    The regexp /^you/ will _not_ find a match because the string does not start with the pattern "you".

    The regexp /^you/m will find a match because the 'm' (multiline) flag says it's OK to treat each physical line of a multiline string as a start of a string.

    You have to be careful when you deploy the 'm' flag because not all browsers recognize it. It works in IE 5.5 or later for Windows and NN 6 or later. Not for IE/Mac or NN 4. Using the 'm' flag causes script errors in the older browsers.

  • Page 1027. In the discussion of the test() method, the pointer in the last sentence should be to Listing 38-3.
  • Page 1051. I thought I fixed this 3rd edition error, but I guess not. In the paragraph following the syntax model, the second sentence should read: "Labels are surrounded by quotes when the labels represent string values of the expression." The example in Listing 39-6 clearly shows this.
  • Page 1052. In Listing 39-6, the second array constructor is missing parentheses: var snacks = new Array()
  • Page 1066. The error numbers reported by IE have to be massaged a "bit" to obtain the number that corresponds to Microsoft's documented errors for IE/Windows. Use the Bitwise AND operator (&) and hexadecimal value FFFF to get a meaningful number:

       var errNum = errorObj.number & x0FFFF

    A list of IE runtime errors and their meaning can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmscRunTimeErrors.asp. Of course these error reports are no more accurate or revealing than IE's frequently deceptive error messages that occur normally.

  • Pages 1140ff. The URLs shown as sources for more information about the IE/Windows objects are no longer valid (surprise, surprise!). The most recent URL for the ActiveXObject info is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsobjActiveXObject.asp. The table of contents that appears in the frameset for that page includes links to most of the other objects described in this section of JSBible..
  • Pages 1143-1145. Microsoft must have realized what a potential security hole a client-controlled FileSystemObject could be. This ActiveX control is no longer accessible from client-side JavaScript (or VBScript).

    Update! Mats Lundgren from Sweden provides an example of how you can reach this ActiveX object, provided the user agrees to download and install a Visual Basic Control Cabinets File (the user gets a Security Warning before installation). Mats offers some sample code you can try at your own risk. The script portion is as follows:

    function LoadFile()
    {
       CommonDialog1.ShowOpen();

       var fileName = CommonDialog1.FileTitle;
       var fObj = new ActiveXObject("Scripting.FileSystemObject");

       var f = fObj.OpenTextFile(fileName);
       var fileContents = f.ReadAll();

       f.Close();
       var iframeWin = window.message;
       iframeWin.document.write(fileContents);
    }

    The HTML portion is as follows:

    <BUTTON ONCLICK="LoadFile();">Open</BUTTON>

    <OBJECT ID="CommonDialog1" WIDTH="0" HEIGHT="0"
    CLASSID="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB"
    CODEBASE="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
       <PARAM NAME="CancelError" VALUE="1">
       <PARAM NAME="DialogTitle" VALUE="Select File">
       <PARAM NAME="Filter" VALUE="(*.txt)|*.txt|(*.htm)|*.htm|All Files(**)|*.*">
    </OBJECT>

  • Pages 1230/1232. I hope you're using the embeddable Evaluator code from the CD, because I know I couldn't survive without it. But a reader pointed out an operational consideration for the trace() utility. Because the utility relies on the existence of the Evaluator's form fields to display the trace's output, the trace() function can't output its results while executing a script as the page loads and before the Evaluator renders.

    To work around this, accumulate the trace() function's message data in one of The Evaluator's built-in global variables (a to z), and then type that variable name into the top text box of The Evaluator after the page loads. You can also devise more complex ways with the help of frames or subwindows, if you prefer.

  • Page 1298. Listing 49-2b mentioned on this page is not on the CD, so view it here. Save the page to your local disk if you like. I have written the code to avoid the horrible eval() function noted on the page.
  • Page 1437. In the box for the location object, the search property got cropped out inadvertently. Unfortunately, this goof propagates through all the printout versions of the Quick Reference on the CD. If you've printed out the Quick Reference, add the search property under protocol.
  • Page 1477. Page reference range for the charCode property, event object (NN6+) should read: 767-769.

Updated Listings

  • Listing 16-13. This listing somehow escaped the CD-ROM. It provides a live example of the window.pageXOffset and window.pageYOffset properties for Netscape Navigator 4 and 6. You can open the example here, and save it to your local hard disk.
  • Listing 31-16. The getClipRect() function needs a revision to follow the correct way to represent the style.clip property, with no commas between the length values. Here's the revision:

    // convert clip property string to an object
    function getClipRect(elem) {
       var clipString = elem.style.clip
       // get rid of "rect("
       clipString = clipString.match(/\(.*\)/)[0].substr(1)
       // get rid of "px," and "px)"
       clipString = clipString.replace(/px,*\)*/g,"")
       // replace spaces with commas
       clipString = clipString.replace(/\s/g,",")
       // turn remaining string into an array
       clipArray = clipString.split(",")
       // make object out of array values
       var clipRect = {top:parseInt(clipArray[0]), right:parseInt(clipArray[1]), bottom:parseInt(clipArray[2]), left:parseInt(clipArray[3])}
       return clipRect
    }

    You also need to change the style specification of the final div element to remove the commas:
       clip:rect(0px 360px 180px 0px);

  • Listing 31-21. On page 896, ninth line from the bottom, the </LAYER> tag should obviously be a </DIV> tag.

    More: Another reader wondered why the <DIV> tag has a <SPAN> tag nested inside. That element is an artifact from the original NN4 version of the script (from earlier in the chapter). Since I tried to demonstrate both IE and W3C DOM versions of the old stuff with the least disruption, I left the <SPAN> in there. Fortunately, you don't have to play those nesting tricks in the IE or W3C DOMs because any element can be designated positioned.

  • Listings 36-01 and 36-02. The customDateString() function in both listings goes too far to accommodate older browsers and historic dates. Assuming you don't need to work with dates prior to 1900, the next-to-last statement of of the function should be:

        theYear += (theYear < 1900) ? 1900 : 0

    If you need historical dates, change the comparison value to 200. This will take care of dates back to the year 200 A.D. and users of Version 2 and 3 browsers through the year 2099. After that, they should seek counseling.

  • Listings 39-08 through 39-10. While paying attention to the exception handling, I let a simple error slip by that puts the wrong letter into the output text box. The last statement of the getLetter() function in all three of these listings should be:

        fld.form.output.value = letters[inp - 1]

  • Listing 43-5. The isNumber() function is more robust by disallowing entry of only a decimal point and no numbers.

    // general purpose function to see if a suspected numeric input
    // is a positive or negative number
    function isNumber(inputVal) {
       var oneDecimal = false
       var digitCount = 0
       inputStr = inputVal.toString()
       for (var i = 0; i < inputStr.length; i++) {
          var oneChar = inputStr.charAt(i)
          if (i == 0 && oneChar == "-") {
             continue
          }
          if (oneChar == "." && !oneDecimal) {
             oneDecimal = true
             continue
          }
          if (oneChar < "0" || oneChar > "9") {
             return false
          } else {
             digitCount++

          }
       }
       return (digitCount > 0)
       }
    }

  • Listings 49-01 through 49-03. I forgot to take into account the smarter way that browsers and internal PC clocks treat dates with respect to the local Daylight Saving Time settings (for many parts of the world). As a result, all three calendar examples show October to have 32 days. That's because the function that calculates the number of days in a month uses the number of days between the first of the current month and the first of the next month. The math -- dividing the two dates in milliseconds by the number of milliseconds in a day -- causes this error because of the "extra hour" that occurs during the last Sunday of October (in many parts of the Northern hemisphere).

    One fix prevents calculations from using the absolute borderline case for calculating the number of days in a month. Change the getMonthLen() function as follows:

    // number of days in the month
    function getMonthLen(theYear, theMonth) {
        var oneHour = 1000 * 60 * 60
        var oneDay = oneHour * 24
        var thisMonth = new Date(theYear, theMonth, 1)
        var nextMonth = new Date(theYear, theMonth + 1, 1)
        var len = Math.ceil((nextMonth.getTime() -
            thisMonth.getTime() - oneHour)/oneDay)
        return len
    }

    October now has 31 days, and the rest of the months continue to have the correct number of days.

    Here are the live "Month at a Glance" example files (including the one missing from the CD:
        Listing 49-01 (all browsers)
        Listing 49-02 (all browsers)
        Listing 49-02b (all browsers)
        Listing 49-03 (IE4+/Windows only and NN6; Do not open with IE5/Mac or Opera 5 because they do not support DOM table methods)

  • > Listings 56-01 (mapgame.htm). I updated this file for better drag tracking. You can see the results in action and download the file from the directory.

Notes

  • Image Type input Elements. Perhaps for historical reasons (in DOM Level 0, the image type input element was not addressable as an object), you cannot reference an image type input element through the Level 0 referencing scheme of document.formName.inputName. Nor do these controls show up in the collection returned by a form's elements property. The exception to this is IE/Mac, which does allow such references.

  • mailto: URLs in Forms (Chapter 23) Implementation of e-mailed forms has been uneven through the years, and the situation gets only worse with Netscape 6 and 7. Although NN 4 supported this feature to a reasonable extent, the Mozilla browser at least through 1.0 (from which Netscape 7 comes) does not implement mailto: URLs for form actions as before. A hotly contested internal debate has raged for more than a year and a half on the issue, and the implementation target keeps pushing forward.

    There is a crude workaround exclusively for NN6/7, but it has limitations. The workaround involves a magic hidden input field whose name and id are body:

       <INPUT TYPE="hidden" NAME="body" ID="body">

    Any string you assign to the value property of that hidden field becomes embedded in the body of the resulting e-mail message. Specify the mailto: URL as before.

    But there's a rub to this implementation: the METHOD attribute of the form must be set to get for this magic hidden data to become embedded in the message. This is counter to the post method that IE and NN4 need to get the data attached/embedded into the message. It's not a big deal to set the method property of the form to "get" while you're busy accumulating control names/values for the hidden "body" field. But, a get method does not pass along the subject portion of the mailto: URL to the message. The message has no subject, and the user typically gets prompted to insert a subject.

    This is a horrible mess, IMHO. It speaks volumes to why I never cared for e-mailing forms in the first place. Yes, the JSBible documents how to do it, but only because if it didn't, I'd be strung up from a high tree.

    If anyone has good experience with free or low-cost form-processing sites (that let your pages submit forms to a real server CGI, which then forwards the data to you via e-mail), I'd like to pass along that info to others here. Not everybody has access to their Web servers to write their own Perl scripts for this kind of work. This "hands-off" form submission approach is important to lots of sites.

  • Table Modification Methods (Chapter 27) A couple of references to the TABLE.insertRow() and TR.insertCell() methods discuss the parameter -1 as a signal to append the new item to the end of the table or row. This parameter is unique to Internet Explorer. It is not specified in the W3C DOM, and Netscape 6+ does not recognize this value. To append a row or cell using these table insertion methods, use the length of the collection as the parameter. For example, to append a new table row to a table:

       var oneTable = document.getElementById("myTable")
       var newTR = oneTable.insertRow(oneTable.rows.length)

    Remember that IE5/Mac does not handle table modification methods well at all. Regretably, I bypass that browser for dynamic tables.

  • Accessing CD-ROM Files in Solaris 2.5.1. Reader Michael Bloom was kind enough to share a solution he tracked down for a problem he was having with the CD. If you are running Solaris 2.5.1 and cannot read all the files on the CD-ROM, you can obtain an official Sun patch that fixes the problem. The patch number is 104560-05 for Sparc and 104561 for Solaris/Intel.
  • META.content and META.httpEquiv Properties (Chapter 20). Even though these two properties are read/write, altering their values after the page loads does not influence the way they work. Therefore, if you use a <META> tag to perform automatic refreshes, you cannot modify the URL or delay after the browser reads the tag and its attributes.
  • NN6.2 window.status and Rollovers. Netscape 6 has a nasty bug that prevents changes to the window.status property to stay visible when the property changes in response to a link rollover. It's partially a timing problem, and partially a problem that the default rollover behavior (showing the link's URL) cannot be overridden. There are 1.5 solutions to the problem:

    1. Introduce an artificial delay in displaying the message so that it executes after the default action:
      onmouseover="setTimeout('status=\'Bert & Ernie\'', 0);"
      onmouseout="setTimeout('status=\'\'', 0);"
      
    2. Leave your mouseover code the way it is, and assign your text to the link's title attribute so it appears as a tooltip.

    If you have been following my advice, you're not putting mission-critical information into the statusbar, and not having your rollover message appear down there won't "break" your user interface. While the code fix (#1) works in all browsers, I'm not fond of introducing squirrely workarounds for a non-essential page feature to accommodate a small percentage of visitors.

  • NN6 Opacity Filter. Pages 871ff. talk about the IE/Windows filter object, which includes, among many other effects, the Alpha effect for controlling opacity of content. Although Netscape 6 doesn't have this ActiveX filtering stuff, it does have its own proprietary CSS-like syntax (and corresponding style object property) for opacity. The CSS attribute name is -moz-opacity (note the leading hyphen), and the property is elementRef.style.mozOpacity. The value range is the same as the IE Alpha filter: a floating poing number between 0 and 1, with 1 being completely opaque. You can include both CSS syntaxes in a style rule, and each supporting browser will recognize its own syntax. Opacity/transparency is a cool effect, but also be sure to check the results on browser versions that don't support it.
  • About Pages Numbered CD-nnn. Table of Contents and Index references to pages numbered CD-nnn point to pages from the Tutorial chapters that are published on the CD-ROM only. To find the chapter to which the cited page belongs, refer to the Table of Contents at the front of the book. As you thumb through the TOC, you'll see the chapters with CD numbers. Find the chapter that contains the desired CD-nnn page number to determine where to look for the page in the Acrobat file.
  • About the alert() Method. A reader who developed almost exclusively in the Windows environment relied on the beep generated when the Alert dialog appeared as an aural reminder alarm for an application. But be aware that the beep sound is not necessarily a part of the alert() method. Some browsers and some operating systems sound a beep when the alert appears. Not all do.
  • Dynamic Forms and Tables in NN6. Here's a weird one if your scripts need to add form controls and place them inside a table.

    NN6 exhibits a few problems for which there are cross-browser workarounds. First, the most reliable way to dynamically include a TABLE inside an empty FORM element is to generate the TABLE element and its contents first in memory (using document.createElement("TABLE") and the various table object methods for inserting rows and cells -- also using document.createElement() to populate the cells with INPUT or other elements). Then use the appendChild() method of the FORM element to insert the dynamically-generated table inside the FORM element.

    At this point, however, NN6 exhibits a bug that prevents the form.elements array from knowing about the controls inside the form. The controls are accessible by name, but only in a pure scripted reference (e.g., document.myForm.myTextBox). Using document.elements[] either with a numeric or name index does not work in NN6 when mixing dynamically generated tables and forms. Therefore, you can use the eval() function to create a valid reference to the control (eval("document.myForm." + "elemName")). If you assign an ID to the form controls, you can also use document.getElementById() to reference the control (and thus avoid the dreaded eval() function).

  • IE Data Binding and the Mac. IE5 for the Macintosh does support some Microsoft Data Binding facilities. For example, the text-file-based Data Source Object used to demonstrate the relevant properties in Chapter 15 (dataField, dataSrc, etc.) works to a degree with the tab-delimited example files. But not all operations in the example work as they do in the Windows version. Microsoft clearly documents that support for Data Binding with Remote Data Services (e.g., server-based SQL databases) is limited to the Win32 environment.
  • Adjusting FRAMESET cols and rows Properties in NN6 There is a known bug in NN6 and NN6.1 that script control of the cols and rows properties of a FRAMESET object does not refresh the layout when the change is made to a nested frameset. For a single frameset, as shown in JavaScript Bible 4th/Gold editions with Listings 16-46 through 16-48, the adjustments work fine for hiding/showing/adjusting frames on the fly.