Visual Basic Concepts
Many elements on an HTML page have a default action. For example, the default action for a hyperlink is to launch the specified Web page when clicked. When you write Visual Basic code for an object on the page, you must include a statement that enables the default action to occur after your procedure is processed.
In Internet Explorer 4.x, when you attach an event to any object, the system returns a True or False value when the event is fired. A return value of True allows the default action to occur, and a value of False prevents the action from occurring. Visual Basic always defaults booleans to False, so by default, any event procedure the system runs prevents the default action from occurring. To avoid this problem, you must include a line of code that returns a value of True in order for the action to occur.
For example, suppose you have the following hyperlink on your HTML page:
<a href = "http://www.microsoft.com">Go to Microsoft</a>
You want to write additional code that intercepts this request and performs a procedure before the link is followed to the Microsoft site. The following code shows the correct way to do this:
Private Function Hyperlink1_onclick() as Boolean
‘ Your event procedure code here
‘ Send a true value to the system to request default processing
Hyperlink1_onclick = True
End Function
If you leave out the line of code that sends the True value, the system will process the code you’ve written, but will not open the Web site specified in the hyperlink tag.