IE Option Setting - Enable Script Debugging

This section provides a tutorial example on how to enable the script debugging option in IE 6.0 to watch the runtime error message raised from a VBScript example code.

Since we have been using Internet Explorer (IE) as the host environment in previous sections, let's look at what will IE do when the VBScript raises a runtime error.

IE 6.0 supports an option called "Disable Script Debugging (Internet Explorer)" on the "Advanced" tab. Let's uncheck it, meaning enable script debugging as shown in the picture below:

Enable Script Debugging in IE
Enable Script Debugging in IE

Now run the following VBScript example:

<html>
<body>
<!-- runtime_error.html
 - Copyright (c) 1998 HerongYang.com. All Rights Reserved.
-->
<pre>
<script language="vbscript">
   document.writeln("Before statement: x = 1/0")
   x = 1/0            ' Division by zero
   
   document.writeln("Before statement: y = CInt(777777)")
   y = CInt(777777)   ' Overflow

   document.writeln("Before statement: y = CInt(777777)")
   z = 1 + "2nd"      ' Type mismatch
   
   document.writeln("End of test")
</script>
</pre>
</body>
</html>

You should get a dialog box with this message:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 8
Error: Division by zero

You can click the "No" button to close the dialog box.

IE Runtime Error
IE Runtime Error

What happened in the example:

Table of Contents

 About This Book

 Introduction of VBScript - Visual Basic Scripting Edition

 Variant Data Type, Subtypes, and Literals

 Arithmetic Operations

 Numeric Comparison Operations and Logical Operations

 String Operations - Concatenation and Comparison

 Variable Declaration and Assignment Statement

 Expression and Order of Operation Precedence

 Statement Syntax and Statement Types

 Array Data Type and Related Statements

 Array References and Array Assignment Statements

 Conditional Statements - "If ... Then" and "Select Case"

 Loop Statements - "For", "While", and "Do"

 "Function" and "Sub" Procedures

 Built-in Functions

 Inspecting Variables Received in Procedures

Error Handling Flag and the "Err" Object

 Error Handling Rules Overview

IE Option Setting - Enable Script Debugging

 "On Error Resume Next" - Turning on Error Handling

 "On Error GoTo 0" - Turning off Error Handling

 "Err.Number" and "Err.Clear()" - Error Code and Clear Method

 Built-in "Err" Object Properties and Methods

 "Err.Raise()" - Raising Your Own Errors

 Regular Expression Pattern Match and Replacement

 scrrun.dll - Scripting Runtime DLL Library

 Creating Your Own Classes

 IE Web Browser Supporting VBScript

 IIS ASP Server Supporting VBScript

 WSH (Windows Script Host)

 References

 Full Version in PDF/EPUB