To learn more about author Sanjaya Hettihewa, please visit the author's homepage.
Features of VBScript are comprehensively covered in previous chapters. This chapter demonstrates how VBScript can be used to develop sophisticated, dynamic, and interactive Web applications. The next few sections demonstrate how to create VBScript applications using information presented in previous chapters.
A simple calculator can be implemented using VBScript and HTML form data-entry elements. You might want to adopt the Simple Calculator application presented in this section for your Web site and make it available for users to perform online calculations.
Using functions and control structures described in earlier chapters, a simple
calculator can be created using VBScript. If you want to experiment with the source
code of the calculator program, it is included in the CD-ROM kit that accompanies
this resource library (\Chap-23\Lesson1.htm). Shortly, you will learn how to create
a calculator similar to the one shown in Figure 23.1.
Figure 23.1. The Simple Calculator application.
Operators and numbers can be entered into the calculator either by using the numeric buttons shown in Figure 23.1 or by typing them into one of the three text boxes. Before you proceed, experiment with the calculator program and find out how it works. When the Simple Calculator Web page is invoked and numbers are typed using command buttons, they appear in the left-hand text box. After a valid operator is entered into the operator text box, numbers entered next appear on the right-hand text box. At this point, if the Evaluate button is clicked, the VBScript program evaluates the expression entered and returns its value in a dialog box, as shown in Figure 23.2.
After the OK button in the dialog box shown in Figure 23.2 is clicked, the result
of the calculation is copied to the first text box, as shown in Figure 23.3. The
user can then continue performing calculations using results of previous calculations.
Figure 23.2. When the Evaluate button
is clicked, the VBScript program calculates the expression entered and returns its
value in a dialog box.
Figure 23.3. The result of a calculation is copied to the first text box so that it can be used as part of another calculation.
Let's examine the calculator program in detail and learn how it works. The following VBScript subroutine displays a dialog box similar to the one shown in Figure 23.4 when a user clicks on the About button. Note how the string-concatenation operator is used in line 4 to merge two strings.
1: Sub BtnAbout_OnClick 2: titleString = "Web Site Developer's Guide for Windows NT" 3: helloString = "Simple VBScript calculator by " 4: helloString = helloString & "Sanjaya Hettihewa." 5: MsgBox helloString, 64, titleString 6: End Sub
Figure 23.4. The About dialog box.
Error checking is an important part of any application. One of VBScript's strengths is its capability to perform error checks when users enter data into a form. By using the OnChange event, it is possible to check the value of a text box that was recently changed by the user. The subroutine shown next makes sure the user entered a valid number into a text box that is used to obtain an operand from the user. The error-checking subroutine of the second operand is similar to the one shown next. Note how Chr(10) is used to create a multiline string. As you can see in Figure 23.5, when a user enters an invalid number, the following subroutine informs the user and resets the text box.
1: Sub Operand1Box_OnChange 2: IF (NOT IsNumeric(Operand1Box.Value)) THEN 3: MsgBoxString = "Do not type invalid characters " 4: MsgBoxString = MsgBoxString & "into the Results Window! " 5: MsgBoxString = MsgBoxString & chr(10) 6: MsgBoxString = MsgBoxString & "Results Window will now be reset." 7: MsgBox MsgBoxString , 48 , "Invalid input detected!" 8: Operand1Box.Value = 0 9: END IF 10: End Sub
Figure 23.5. Invalid numbers entered by users are detected by the Operand1Box _OnChange subroutine.
A similar subroutine, shown next, determines whether operators entered into the Operator text box are valid. Note how the underline character (_) is used to join a long expression that spans several lines. If an invalid operator is entered, it is detected by the OperatorBox_OnChange subroutine, the text box is reset, and the user is informed of the invalid input, as shown in Figure 23.6.
1: Sub OperatorBox_OnChange 2: IF (NOT((OperatorBox.Value = "+" ) OR _ 3: (OperatorBox.Value = "-" ) OR _ 4: (OperatorBox.Value = "*" ) OR _ 5: (OperatorBox.Value = "?" ))) THEN 6: MsgString = "Do not type invalid characters " 7: MsgString = MsgString & "into the operator text box! " 8: MsgString = MsgString & chr(10) 9: MsgString = MsgString & "The operator text box will now be reset." 10: MsgString = MsgString & chr(10) & chr(10) 11: MsgString = MsgString & "Valid input: +, -, *" 12: MsgBox MsgString , 48 , "Invalid input detected!" 13: OperatorBox.Value = "?" 14: END IF 15: End Sub
Figure 23.6. Invalid operators entered into the Operator text box are detected by the OperatorBox _OnChange subroutine.
The Backspace button is used to delete characters entered into one of the Operand text boxes. The subroutine associated with the Backspace button, BtnDelete_OnClick, is a smart function subroutine. As shown in line 2 of the following code, the subroutine first examines the Operator text box and determines whether a calculation has already been performed. If so, it knows that any numbers added appear on the text box to the right and deletes a digit from that text box. If not, a digit from the left text box is deleted.
1: Sub BtnDelete_OnClick 2: IF (OperatorBox.Value = "?") THEN 3: IF ((Len (Operand1Box.Value) > 0) AND (Operand1Box.Value <> 0)) THEN 4: Operand1Box.Value = Left (Operand1Box.Value, Len (Operand1Box.Value)-1) 5: IF (Len (Operand1Box.Value) = 0) THEN 6: Operand1Box.Value = 0 7: END IF 8: END IF 9: ELSE 10: IF ((Len (Operand2Box.Value) > 0) AND (Operand2Box.Value <> 0)) THEN 11: Operand2Box.Value = Left (Operand2Box.Value,Len (Operand2Box.Value)-1) 12: IF (Len (Operand2Box.Value) = 0) THEN 13: Operand2Box.Value = 0 14: END IF 15: END IF 16: END IF 17: End Sub
The Evaluate button calculates two operands using an operator and returns a value as shown in Figure 23.2. As you can see in line 2 of the following program listing, the BtnEvaluate_OnClick subroutine first checks the Operator text box. If a valid operator is found, it performs a calculation and displays it using a dialog box. If not, a dialog box similar to the one shown in Figure 23.7 is displayed. Afterwards, as shown in lines 17 and 18, the Operand text boxes are reset so that additional calculations can be performed. Note that the result of the calculation is copied in line 17 to the left Operand text box so that the result of the calculation can be used as part of another calculation.
1: Sub BtnEvaluate_OnClick 2: IF (OperatorBox.Value = "?") THEN 3: MsgBoxString = "A valid operator is required to carry out " 4: MsgBoxString = MsgBoxString & "an evaluation." 5: MsgBoxString = MsgBoxString & chr(10) 6: MsgBoxString = MsgBoxString & "Valid operators are: +, -, *" 7: MsgBox MsgBoxString , 48 , "Invalid operator!" 8: ELSE 9: IF (OperatorBox.Value = "+") THEN 10: answer = CDbl(Operand1Box.Value) + CDbl(Operand2Box.Value) 11: ELSEIF (OperatorBox.Value = "-") THEN 12: answer = CDbl(Operand1Box.Value) - CDbl(Operand2Box.Value) 13: ELSEIF (OperatorBox.Value = "*") THEN 14: answer = CDbl(Operand1Box.Value) * CDbl(Operand2Box.Value) 15: End IF 16: MsgBox answer , 64 , "Results of calculation" 17: Operand1Box.Value = answer 18: Operand2Box.Value = 0 19: END IF 20: End Sub
Figure 23.7. The operands are evaluated only if a valid operator is found.
The AddDigit subroutine adds a digit selected via one of the calculator buttons into one of the operand text boxes. As shown in line 4 of the following program listing, if a valid operator is not present, digits are added to the left text box. However, if a valid operator is present, the user has either entered a valid number to the left text box or that the left text box contains a result of a previous calculation (in which case, the digit selected by the user is added to the right text box). It's possible that the user will try to add too many digits. This is taken care of in lines 9 and 16, where a separate subroutine is used to inform the user by displaying a dialog box similar to the one shown in Figure 23.8.
1: Sub AddDigit ( digit ) 2: REM Just in case there are any preceding zeros or spaces 3: Operand1Box.Value = CDbl (Operand1Box.Value) 4: IF ( OperatorBox.Value = "?") THEN 5: IF ( Len ( Operand1Box.Value ) < 14 ) THEN 6: Operand1Box.Value = Operand1Box.Value & digit 7: Operand1Box.Value = CDbl (Operand1Box.Value) 8: ELSE 9: TooManyDigits 10: END IF 11: ELSE 12: IF ( Len ( Operand2Box.Value ) < 14 ) THEN 13: Operand2Box.Value = Operand2Box.Value & digit 14: Operand2Box.Value = CDbl (Operand2Box.Value) 15: ELSE 16: TooManyDigits 17: END IF 18: END IF 19: End Sub
Figure 23.8. The AddDigit subroutine prevents users from entering too many digits into a text box.
For your reference, the full source code of the Calculator application is provided in Listing 23.1.
<!-- (C) 1996 Sanjaya Hettihewa (http://www.NetInnovation.com/) All Rights Reserved. Permission is hereby given to modify and distribute this code as you wish provided that this block of text remains unchanged. !--> <HTML> <HEAD> <TITLE>VBScript Tutorial: Simple Calculator</TITLE> </HEAD> <TABLE COLSPEC="L20 L20 L20" BORDER=2 WIDTH=10 HEIGHT=10> <CAPTION ALIGN=top>Simple Calculator</CAPTION> <TR><TD> <BODY BGCOLOR="#FFFFFF" TEXT="#0000FF" LINK="#B864FF" VLINK="#670000" ALINK="#FF0000"> <IMG ALIGN=TOP SRC="vbscript.jpg"> <TD> <TABLE BORDER=2 > <CAPTION ALIGN=top>Results Window</CAPTION> <TD> <input type=text size=14 maxlength=14 name="Operand1Box" value="0"> <input type=text size=1 maxlength=1 name="OperatorBox" value="?"> <input type=text size=14 maxlength=14 name="Operand2Box" value="0"> </TD> </TABLE> <TABLE COLSPEC="L20 L20 L20" > <CAPTION ALIGN=top>Calculator Keys</CAPTION> <TR> <TD><INPUT TYPE=BUTTON VALUE="One" NAME="BtnOne"></TD> <TD><INPUT TYPE=BUTTON VALUE="Two" NAME="BtnTwo"></TD> <TD><INPUT TYPE=BUTTON VALUE="Three" NAME="BtnThree"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE="Four" NAME="BtnFour"></TD> <TD><INPUT TYPE=BUTTON VALUE="Five" NAME="BtnFive"></TD> <TD><INPUT TYPE=BUTTON VALUE="Six" NAME="BtnSix"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE="Seven" NAME="BtnSeven"></TD> <TD><INPUT TYPE=BUTTON VALUE="Eight" NAME="BtnEight"></TD> <TD><INPUT TYPE=BUTTON VALUE="Nine" NAME="BtnNine"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE="Zero" NAME="BtnZero"></TD> <TD><INPUT TYPE=BUTTON VALUE="Backspace" NAME="BtnDelete></TD> <TD><INPUT TYPE=BUTTON VALUE="Clear" NAME="BtnClear"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE="+" NAME="BtnPlus"></TD> <TD><INPUT TYPE=BUTTON VALUE="-" NAME="BtnMinus"></TD> <TD><INPUT TYPE=BUTTON VALUE="*" NAME="BtnMultiply"></TD> </TR> <TR> <TD><INPUT TYPE=BUTTON VALUE="Evaluate" NAME="BtnEvaluate"></TD> <TD><INPUT TYPE=BUTTON VALUE="About" NAME="BtnAbout"></TD> </TR> </TABLE> </TR> </TABLE> <P> <B><FONT FACE="Comic Sans MS" SIZE=6 COLOR=RED> VBScript Tutorial: <FONT></B> <I><FONT FACE="Comic Sans MS" SIZE=5 COLOR=BLUE> "Simple Calculator" </I><P><FONT> <SCRIPT LANGUAGE=VBScript> <!-- To hide VBScript code from technologically challenged browsers Sub BtnAbout_OnClick titleString = "Web Site Developer's Guide for Windows NT" helloString = "Simple VBScript calculator by " helloString = helloString & "Sanjaya Hettihewa." MsgBox helloString, 64, titleString End Sub Sub Operand1Box_OnChange IF (NOT IsNumeric(Operand1Box.Value)) THEN MsgBoxString = "Do not type invalid characters " MsgBoxString = MsgBoxString & "into the Results Window! " MsgBoxString = MsgBoxString & chr(10) MsgBoxString = MsgBoxString & "Results Window will now be reset." MsgBox MsgBoxString , 48 , "Invalid input detected!" Operand1Box.Value = 0 END IF End Sub Sub Operand2Box_OnChange IF (NOT IsNumeric(Operand2Box.Value)) THEN MsgBoxString = "Do not type invalid characters " MsgBoxString = MsgBoxString & "into the Results Window! " MsgBoxString = MsgBoxString & chr(10) MsgBoxString = MsgBoxString & "Results Window will now be reset." MsgBox MsgBoxString , 48 , "Invalid input detected!" Operand2Box.Value = 0 END IF End Sub Sub OperatorBox_OnChange IF (NOT((OperatorBox.Value = "+" ) OR _ (OperatorBox.Value = "-" ) OR _ (OperatorBox.Value = "*" ) OR _ (OperatorBox.Value = "?" ))) THEN MsgString = "Do not type invalid characters " MsgString = MsgString & "into the operator text box! " MsgString = MsgString & chr(10) MsgString = MsgString & "The operator text box will now be reset." MsgString = MsgString & chr(10) & chr(10) MsgString = MsgString & "Valid input: +, -, *" MsgBox MsgString , 48 , "Invalid input detected!" OperatorBox.Value = "?" END IF End Sub Sub BtnOne_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 1 ) ELSE ResetResultsWindow END IF End Sub Sub BtnTwo_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 2 ) ELSE ResetResultsWindow END IF End Sub Sub BtnThree_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 3 ) ELSE ResetResultsWindow END IF End Sub Sub BtnFour_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 4 ) ELSE ResetResultsWindow END IF End Sub Sub BtnFive_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 5 ) ELSE ResetResultsWindow END IF End Sub Sub BtnSix_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 6 ) ELSE ResetResultsWindow END IF End Sub Sub BtnSeven_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 7 ) ELSE ResetResultsWindow END IF End Sub Sub BtnEight_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 8 ) ELSE ResetResultsWindow END IF End Sub Sub BtnNine_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 9 ) ELSE ResetResultsWindow END IF End Sub Sub BtnZero_OnClick IF (IsNumeric(Operand1Box.Value)) THEN AddDigit ( 0 ) ELSE ResetResultsWindow END IF End Sub Sub BtnDelete_OnClick IF (OperatorBox.Value = "?") THEN IF ((Len (Operand1Box.Value) > 0) AND (Operand1Box.Value <> 0)) THEN Operand1Box.Value = Left (Operand1Box.Value, Len (Operand1Box.Value) - 1) IF (Len (Operand1Box.Value) = 0) THEN Operand1Box.Value = 0 END IF END IF ELSE IF ((Len (Operand2Box.Value) > 0) AND (Operand2Box.Value <> 0)) THEN Operand2Box.Value = Left (Operand2Box.Value, Len (Operand2Box.Value) - 1) IF (Len (Operand2Box.Value) = 0) THEN Operand2Box.Value = 0 END IF END IF END IF End Sub Sub BtnClear_OnClick Operand1Box.Value = 0 Operand2Box.Value = 0 OperatorBox.Value = "?" End Sub Sub BtnPlus_OnClick OperatorBox.Value = "+" End Sub Sub BtnMinus_OnClick OperatorBox.Value = "-" End Sub Sub BtnMultiply_OnClick OperatorBox.Value = "*" End Sub Sub BtnEvaluate_OnClick IF (OperatorBox.Value = "?") THEN MsgBoxString = "A valid operator is required to carry out " MsgBoxString = MsgBoxString & "an evaluation." MsgBoxString = MsgBoxString & chr(10) MsgBoxString = MsgBoxString & "Valid operators are: +, -, *" MsgBox MsgBoxString , 48 , "Invalid operator!" ELSE IF (OperatorBox.Value = "+") THEN answer = CDbl(Operand1Box.Value) + CDbl(Operand2Box.Value) ELSEIF (OperatorBox.Value = "-") THEN answer = CDbl(Operand1Box.Value) - CDbl(Operand2Box.Value) ELSEIF (OperatorBox.Value = "*") THEN answer = CDbl(Operand1Box.Value) * CDbl(Operand2Box.Value) End IF MsgBox answer , 64 , "Results of calculation" Operand1Box.Value = answer Operand2Box.Value = 0 END IF End Sub Sub AddDigit ( digit ) REM Just in case there are any preceeding zeros or spaces Operand1Box.Value = CDbl (Operand1Box.Value) IF ( OperatorBox.Value = "?") THEN IF ( Len ( Operand1Box.Value ) < 14 ) THEN Operand1Box.Value = Operand1Box.Value & digit Operand1Box.Value = CDbl (Operand1Box.Value) ELSE TooManyDigits END IF ELSE IF ( Len ( Operand2Box.Value ) < 14 ) THEN Operand2Box.Value = Operand2Box.Value & digit Operand2Box.Value = CDbl (Operand2Box.Value) ELSE TooManyDigits END IF END IF End Sub Sub ResetResultsWindow MsgBoxString = "Do not type invalid characters " MsgBoxString = MsgBoxString & "into the Results Window! " MsgBoxString = MsgBoxString & chr(10) MsgBoxString = MsgBoxString & "Use Calculator keys instead. " MsgBoxString = MsgBoxString & "Results Window will now be reset." MsgBox MsgBoxString , 48 , "Invalid input detected!" Operand1Box.Value = 0 Operand2Box.Value = 0 OperatorBox.Value = "?" End Sub Sub TooManyDigits MsgBoxString = "The number of digits you have typed " MsgBoxString = MsgBoxString & "exceed the maximum" MsgBoxString = MsgBoxString & chr(10) MsgBoxString = MsgBoxString & "number of digits allowed. " MsgBoxString = MsgBoxString & "The digit you selected will " MsgBoxString = MsgBoxString & "not be added. Sorry!" MsgBox MsgBoxString , 48 , "Too many digits!" End Sub !--> </SCRIPT> </BODY> </HTML>
Image maps are used in Web pages to allow users to make a selection by choosing a certain area of a graphic file. A VBScript application can be used to enhance this experience by providing a brief description about the selection the user is about to make by monitoring the location of the mouse pointer. When the mouse pointer is moved over a certain area of the graphic, a brief description about the selection the user is about to make is displayed.
The VBScript application in this section can be used to label a graphic when the
mouse is moved over it. When the Web page containing the VBScript program is invoked,
it looks similar to Figure 23.9. Note that the Description text box contains the
string Hello! Select a link, please.
Figure 23.9. Text box contains the string
Hello! Select a link, please. when the VBScript Web page is invoked.
If the mouse is moved over the graphic in Figure 23.9, the value of the text box
changes as shown in Figure 23.10.
Figure 23.10. When the mouse is moved over the graphic, the value of the text
box changes to No link selected. Please select a link!.
As you can see in Figure 23.11, there are four icons in the graphic to the left
of the browser window. When the mouse is moved over any of these icons, the text
box lists the description of the text box. For example, when the mouse is over the
bulletin-board icon, the value of the text box in Figure 23.10 changes to Post messages
on an online discussion forum. Key subroutines of the label image program are discussed
next.
Figure 23.11. When the mouse is over
one of the icons of the image, the value of the text box changes the icon's description.
To detect mouse movement over the graphic in Figure 23.11, a special identification code must be assigned to the graphic. This is done in line 1 of the following code listing.
1: <A ID="ImageMapGraphic" HREF="ImageMap.Map"> 2: <IMG ALIGN=TOP SRC="vbscript.jpg" ALT="Sample Graphic" ISMAP BORDER=0> 3: </A>
ImageMapGraphic_MouseMove is the heart of the VBScript application shown in Figure 23.11. When the mouse is moved over the graphic, the following subroutine is activated. When the mouse pointer falls in a predetermined region of the graphic, the text box is updated with the description of the region the mouse pointer is over, as shown in line 4 of the following program listing. The HotSpot subroutine simply returns TRUE if the mouse coordinates passed into the HotSpot subroutine fall within a certain region of the graphic.
1: Sub ImageMapGraphic_MouseMove(keyboard,mouse,xPosition,yPosition) 2: 3: IF (HotSpot(xPosition, yPosition, 2, 5, 70, 41)) THEN 4: Description.Value = "Main Homepage" 5: ELSE IF (HotSpot(xPosition, yPosition, 2, 49, 70, 82)) THEN 6: Description.Value = "Send Feedback" 7: ELSE IF (HotSpot(xPosition, yPosition, 2, 84, 70, 117)) THEN 8: Description.Value = "Site Map" 9: ELSE IF (HotSpot(xPosition, yPosition, 2, 119, 70, 164)) THEN 10: Description.Value = "Post messages on an online dicussion forum" 11: ELSE 12: Description.Value = "No link selected. Please select a link!" 13: END IF 14: END IF 15: END IF 16: END IF
If you want to experiment with the VBScript program listed next, it can be found in the CD-ROM kit that accompanies this resource library (\Chap-23\Lesson2.htm). For your reference, the full source code of the Label Image application is given in Listing 23.2.
<!-- (C) 1996 Sanjaya Hettihewa (http://www.NetInnovation.com/) All Rights Reserved. Permission is hereby given to modify and distribute this code as you wish provided that this block of text remains unchanged. !--> <HTML> <HEAD> <TITLE>VBScript Tutorial: Labeling a graphic</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#0000FF" LINK="#B864FF" VLINK="#670000" ALINK="#FF0000"> <TABLE COLSPEC="L20 L20 L20" BORDER=2 WIDTH=10 HEIGHT=10> <CAPTION ALIGN=top>Labeling a graphic</CAPTION> <TR><TD> <A ID="ImageMapGraphic" HREF="ImageMap.Map"> <IMG ALIGN=TOP SRC="vbscript.jpg" ALT="Sample Graphic" ISMAP BORDER=0> </A> </TD><TD> <CENTER><FONT FACE="Comic Sans MS" SIZE=6 COLOR=Black> Description<FONT></CENTER> <input type="text" name="Description" Value="Hello! Select a link, please." size=45><P> <CENTER><INPUT TYPE=BUTTON VALUE="About" NAME="BtnAbout"></CENTER> </TD><TD> </TR> </TABLE> <P> <B><FONT FACE="Comic Sans MS" SIZE=6 COLOR=RED> VBScript Tutorial: <FONT></B> <I><FONT FACE="Comic Sans MS" SIZE=5 COLOR=BLUE> "Labeling a graphic with VBScript" </I><P><FONT> </TD></TR> </TABLE> <SCRIPT LANGUAGE="VBScript"> <!-- To hide VBScript code from technologically challenged browsers Sub BtnAbout_OnClick titleString = "Web Site Developer's Guide for Windows NT" helloString = "Labeling a graphic with VBScript by " helloString = helloString & "Sanjaya Hettihewa." MsgBox helloString, 64, titleString End Sub Sub ImageMapGraphic_MouseMove(keyboard,mouse,xPosition,yPosition) IF (HotSpot(xPosition, yPosition, 2, 5, 70, 41)) THEN Description.Value = "Main Homepage" ELSE IF (HotSpot(xPosition, yPosition, 2, 49, 70, 82)) THEN Description.Value = "Send Feedback" ELSE IF (HotSpot(xPosition, yPosition, 2, 84, 70, 117)) THEN Description.Value = "Site Map" ELSE IF (HotSpot(xPosition, yPosition, 2, 119, 70, 164)) THEN Description.Value = "Post messages on an online dicussion forum" ELSE Description.Value = "No link selected. Please select a link!" END IF END IF END IF END IF End Sub Function HotSpot ( mouseX, mouseY, TopX , TopY, BottomX, BottomY) HotSpot = (mouseX >= TopX) AND _ (mouseX <= BottomX) AND _ (mouseY >= topY) AND _ (mouseY<=bottomY) End Function !--> </SCRIPT> </BODY> </HTML>
VBScript is a powerful client-side scripting language that can be used to develop sophisticated, dynamic, and interactive Web pages with the greatest of ease. Applications presented in this book demonstrate how VBScript applications interact with HTML form data-entry elements, ActiveX controls, and Web-browser objects and events to enhance the Web browsing experience.
© Copyright, Macmillan Computer Publishing. All rights reserved.