JavaScript for Dummies (4th ed.) [Vander Veer 2004-11-19].pdf

(11434 KB) Pobierz
articlopedia.gigcities.com
ENJOY READING AT :
http://articlopedia.gigcities.com
file:///D|/important.html9/13/2006 8:50:19 PM
290
Part V: The Part of Tens
Figure 17-7:
Entering
JavaScript
code
directly into
the console
gives you
instant
feedback.
Microsoft Internet Explorer’s
built-in error display
When you load a JavaScript error-containing Web page into Internet Explorer,
you see an icon in the status bar at the lower-left side of the screen. Double-
clicking the icon displays a pop-up window describing the JavaScript error —
along with hints for fixing that error. Check out Figure 17-8 to see what I
mean.
Figure 17-8 shows that Internet Explorer encountered an error on line 4 of the
HTML file: namely, that
problem
is undefined.
Sure enough, if you take a look at the following HTML code (you find a copy
of the
error.htm
file on the companion CD) you see that line 4 references an
undefined variable called
problem
. (I demonstrate how to define a variable in
Chapter 3.)
<HTML>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript” TYPE=”text/javascript”>
alert(“This is a “ + problem);
...
Chapter 17: Ten (Or So) Tips for Debugging Your Scripts
291
Figure 17-8:
Double-
clicking the
status bar
icon
displays
JavaScript
errors.
292
Part V: The Part of Tens
Appendixes
Part VI
Zgłoś jeśli naruszono regulamin