A syntax error is asking for a "scwerdriver".
A logic error is asking for a flathead screwdriver, then trying to use it on a Philips screw.
You can follow along with the bugs.html file, which gives examples of many of the problems I talk about here.
When the browser gives you a syntax error, note the line number of the error. When you dig back into the script to see what's wrong, however, check for problems above and around that line for the problem as well. An error above the line, especially a missing ), >, or } could be causing the browser to misinterpret what happens next.
On a related note, be aware of "cascading" errors. This means that one error, such as an incorrectly defined function, can cause errors further down the line, for example, when you try to call the function. Correct the first error, then try to run the program again. Subsequent errors may be gone.
Here are some more tips on avoiding--and troubleshooting--programming errors.
- Make sure your double and single quotation marks are matched correctly, especially in long expressions.
[Move on the Part III]
Web Developer® Site Feedback
Copyright © 2000 internet.com Corporation. All rights reserved.