The browser market
|Debugging script in Visual Studio .NET|
|Accessing Mozilla debugger|
- "Increase site performance by selectively displaying preloaded content"
- Logic errors prevent the code from executing as planned. There is nothing wrong with the code (no syntax problems), but the developer has made a mistake in the program logic. These are often the most difficult to trace, because the code is okay.
- Runtime errors are encountered when the actual script is executed. This may happen when the page loads or may be triggered by a page event or via a button. The runtime error in Figure A occurred because the code attempted to access a variable that did not exist.
Follow the logic
The Window portion is optional, and the lone message parameter is a string value representing the message displayed in it. The following example is displayed in Figure E.
|Example alert usage|
You can use the alert window to examine the inner workings at any point in your code. You can display variables to see if they are populated as expected or maybe to determine whether an object exists. You can also place various alerts in the code to determine the progression through a script. The alert stops code execution until the OK button is clicked, so it somewhat resembles a breakpoint in a modern development environment.
Once you locate the error, you can begin the process of fixing it. It is advisable to correct one error at a time to avoid confusion. I've often seen many perceived errors fixed at the same time, only to see other errors occur. Be prudent when you're correcting errors to avoid creating more work.