Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=180400010

Script, Scripting Language, VBScript elements, Server-Side VBScript Function InputBox, MsgBox Function

VBScript Misc Functions

Functions for manipulating misc operation. However all modern browser does not support VBScript InputBox and MsgBox functions directly.

InputBox Function

last updated 9/19/2017

Create and display a standard input dialog box with a text box and a given prompt in the dialog box according to the specified title, default, xpos, ypos, helpfile and context arguments. The dialog box will wait for the user to input text or click a button to continue.

Syntax

InputBox(prompt[, title][, default][, xpos][, ypos][, helpfile, context])

Argument

promptRequired. String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return–linefeed character combination (Chr(13)&Chr(10)) between each line.titleOptional. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.defaultOptional. String expression displayed in the text box as the default response if no other input is provided. If you omit default, the text box is displayed empty.xposOptional. Numeric expression that specifies, in twips, the horizontal distance of the left edge of the dialog box from the left edge of the screen. If xpos is omitted, the dialog box is horizontally centered.yposOptional. Numeric expression that specifies, in twips, the vertical distance of the upper edge of the dialog box from the top of the screen. If ypos is omitted, the dialog box is vertically positioned approximately one-third of the way down the screen.helpfileOptional. String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box. If helpfile is provided, context must also be provided.contextOptional. Numeric expression that identifies the Help context number assigned by the Help author to the appropriate Help topic. If context is provided, helpfile must also be provided.

Returns

Returns a Variant of the String data subtype containing the contents of the text box obtained from input dialog box entered by the user.

Remarks

  • All modern browser does not support VBScript InputBox and MsgBox functions.
  • InputBox function is used to accept and return input text from user.
  • When both helpfile and context are supplied, a Help button is automatically added to the dialog box.
  • If the user clicks OK or presses ENTER, the InputBox function returns whatever is in the text box. If the user clicks Cancel, the function returns a zero-length string ("").

Requirement

1

Examples

Although all modern browser does not support VBScript InputBox and MsgBox functions directly, VBScript can still be tested using Microsoft Internet Explorer 11 after adding '<meta http-equiv="x-ua-compatible" content="IE=10">' to HEAD tag.

Both client side VBScript InputBox and MsgBox functions can be used in server side indirectly through creating a client side Script on the fly to run a ?document.write?.

Ref.:https://msdn.microsoft.com/library/dn384057(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx

Examples of InputBox function

Ref.:

ASP VbScript Command:
<!DOCTYPE html><html>
<head><meta http-equiv="x-ua-compatible" content="IE=10"></head>
<body><%
Response.Write("<" & "script language=VBScript  type=text/vbscript>")
Response.Write("a=InputBox(""test msg"")"&vbCrLf)
Response.Write ("document.write a")
Response.Write ("<" & "/script>")
%></body>
</html>

MsgBox Function

last updated 9/20/2017

Create and display a standard message dialog box with a given prompt in the dialog box according to the specified buttons, title, helpfile and context arguments. The dialog box will wait for the user to click a button to continue.

Syntax

MsgBox(prompt[, buttons][, title][, helpfile, context])

Argument

promptRequire. String expression displayed as the message in the dialog box. The maximum length of prompt is approximately 1024 characters, depending on the width of the characters used. If prompt consists of more than one line, you can separate the lines using a carriage return character (Chr(13)), a linefeed character (Chr(10)), or carriage return–linefeed character combination (Chr(13)&Chr(10)) between each line.buttonsOptional Setting. Numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality of the message box. See Settings section for values. If omitted, the default value for buttons is 0.titleRequired. String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar.helpfileRequired. String expression that identifies the Help file to use to provide context-sensitive Help for the dialog box. If helpfile is provided, context must also be provided. Not available on 16-bit platforms.contextRequired. Numeric expression that identifies the Help context number assigned by the Help author to the appropriate Help topic. If context is provided, helpfile must also be provided. Not available on 16-bit platforms.

Settings

buttons argument

vbConstantValueConstantvbOKOnly0Display OK button only.vbOKCancel1Display OK and Cancel buttons.vbAbortRetryIgnore2Display Abort, Retry, and Ignore buttons.vbYesNoCancel3Display Yes, No, and Cancel buttons.vbYesNo4Display Yes and No buttons.vbRetryCancel5Display Retry and Cancel buttons.vbCritical16Display Critical Message icon. vbQuestion32Display Warning Query icon.vbExclamation48Display Warning Message icon.vbInformation64Display Information Message icon.vbDefaultButton10First button is default.vbDefaultButton2256Second button is default.vbDefaultButton3512Third button is default.vbDefaultButton4768Fourth button is default.vbApplicationModal0Application modal. The user must respond to the message box before continuing work in the current application.vbSystemModal4096System modal. On Microsoft Win16 systems, all applications are suspended until the user responds to the message box. On Microsoft Win32 systems, this constant provides an application modal message box that always remains on top of any other programs that you have running
The first group of values (0–5) describes the number and type of buttons displayed in the dialog box; the second group (16, 32, 48, 64) describes the icon style; the third group (0, 256, 512, 768) determines which button is the default; and the fourth group (0, 4096) determines the modality of the message box. When adding numbers to create a final value for the argument buttons, use only one number from each group.

Returns

Returns a Variant of the Integer data subtype containing the type of button obtained from message dialog box clicked by the user.

Return values of MsgBox function

vbConstantValueConstantvbOK1OKvbCancel2CancelvbAbort3AbortvbRetry4RetryvbIgnore5IgnorevbYes6YesvbNo7No

Remarks

  • All modern browser does not support VBScript InputBox and MsgBox functions.
  • InputBox function is used to accept and return input text from user.
  • When both helpfile and context are provided, the user can press F1 to view the Help topic corresponding to the context.
  • If the dialog box displays a Cancel button, pressing the ESC key has the same effect as clicking Cancel. If the dialog box contains a Help button, context-sensitive Help is provided for the dialog box. However, no value is returned until one of the other buttons is clicked.
  • When the MsgBox function is used with Microsoft Internet Explorer, the title of any dialog presented always contains "VBScript:" to differentiate it from standard system dialogs.

Requirement

1

Examples

Although all modern browser does not support VBScript InputBox and MsgBox functions directly, VBScript can still be tested using Microsoft Internet Explorer 11 after adding '<meta http-equiv="x-ua-compatible" content="IE=10">' to HEAD tag.

Both client side VBScript InputBox and MsgBox functions can be used in server side indirectly through creating a client side Script on the fly to run a ?document.write?.

Ref.:https://msdn.microsoft.com/library/dn384057(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/apps/Hh700404.aspx

Examples of MsgBox function

ASP VbScript Command:
<!DOCTYPE html><html>
<head><meta http-equiv="x-ua-compatible" content="IE=10" /></head>
<body><%
Response.Write("<" & "script language=VBScript  type=text/vbscript>")
Response.Write("a=MsgBox(""test msg"")"&vbCrLf)
Response.Write ("document.write a")
Response.Write ("<" & "/script>")
%></body>
</html>

Sideway BICK Blog

10/04


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013