..
The client-side VBScript provides the developer a large number of dialogs with the user, many more than its historic rival JavaScript, for two reasons:
1. dialog boxes that also uses standard JavaScript objects are part of the browser, and specifically not the language;
2. being a derivative of the VBScript programming language Visual Basic known, has at its disposal the windows box that has in turn available.
We start from the first, or those owners of all browsers, also available for JavaScript. There are three and are part of the window object, even if you do not need to specify it in code.
They are:
<script type="text/vbscript"> Alert "Hello, World!" </ Script>Nothing is more simple and intuitive.
Let us now see a complete example of Confirm:
<script type="text/vbscript">
Dim confirms
confirmation = confirm ("Click either button ...")
Then if confirmed
Alert "You clicked OK!"
Else
Alert "You clicked Cancel!"
End If
</ Script>
The item is stored in a variable and is made a condition to evaluate the choice made and perform different routines, or run only if the choice was made OK, as in the following:
<script type="text/vbscript">
Dim confirms
confirmation = confirm ("Proceed with the execution of the script?")
Then if confirmed
'ROUTINE TO PERFORM ...
End If
</ Script>
We conclude with an example of a prompt:
<script type="text/vbscript">
Dim request
Request = prompt ("Enter your name", "")
If Request = "" Or IsNull (required) Then
Alert "Hello friend!"
Else
End If
</ Script>
The operation is virtually identical to the previous element and the second parameter of the prompt is "" To prevent it written into, by default, the special value "undefined".
| |
ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €. |
| |
Visual Basic 6 (Course)
Make Desktop Applications with VB6. From 39 €. |