Saturday, April 09, 2005
Blog Entry #4
Internet Explorer (5.1.6): Go to the Preferences command under the Edit menu. On the left-hand side of the Preferences window, select the Web Content option under the Web Browser heading. At the bottom of the Web Content settings
Types of Errors
Since working through this primer, I have kept a running log of the different JScript errors that have popped up while surfing the Web with MSIE. Here they are*:
Microsoft JScript compilation errors
Expected identifier or string
Unterminated string constant
Conditional compilation is turned off
Microsoft JScript runtime errors
Object doesn’t support this property or method
Object doesn't support this action
‘whatever’ is undefined
Invalid procedure call or argument
Argument not optional
Out of memory
Out of stack space
(*All of the compilation (syntax) errors but only a couple of the runtime errors appear on the corresponding Microsoft lists linked above. Note that the "Invalid character" compilation error plagues Microsoft's MSDN Library Web sites.)
I will not attempt to define these various errors but am merely listing them here 'for the record'.
Error message information
document.write("Today is Thursday."
With MSIE, the script above generates an "Expected ')' " compilation error:
As you can see, the error message in this case specifies the line of the document (line 7, counting down from the top of the document, as Joe notes) and the character of that line (character 35, counting from the left with the first character indexed as 0, and not 1) that is problematic. Clicking the window's Source button opens a source-code window in which the error location is highlighted:
Unfortunately, some MSIE JScript error message windows do not give the aforementioned line and/or character information, nor a meaningful highlight in the source code - you're on your own in those cases.
appears here. Netscape's description of the error, "missing ) after argument list", is similar to but less intuitive than that of MSIE. With respect to the error location, Netscape identifies line 8 as the problem, perhaps because the script will run if a right parenthesis is put at the start of line 8 (just before </script>), but I again find this less satisfying than MSIE's marking the error at line 7. In lieu of character information, Netscape points, sort of, with a little green arrow to the error, but not very accurately, as you can see. Finally, the source-code window that is opened by clicking the Source File link
has no highlight of the error.
Quick comments on other issues
I don't have anything to add to Joe's remarks (a) on margins and command lines in the "Fixing the Errors" section and (b) on propagating errors in the "Multiple Errors" section of the primer, but I do want to comment on...
"The Error Line"
The end-of-primer assignment and its answer
Joe asks the reader to identify two errors in an 18-line block of code.
The second error, which is generated by the "document.wrte(" ",month,"/",day,"/",year," ")" 15th line, gives an "Object doesn’t support this property or method" run-time error with MSIE and a "document.wrte is not a function" error with Netscape - the misspelling of "write" is NOT a syntax error, in accord with our discussion earlier.