Sideway
output.to from Sideway
Draft for Information Only

Content

VBScript Misc Functions
 InputBox Function
  Syntax
  Argument
  Return
  Remark
  ReqVersion
 Examples
 MsgBox Function
  Syntax
  Argument
  Setting
  Return
  Remark
  ReqVersion
 Examples

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 19 Sep 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.

Return

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

Remark

  • 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 ("").

ReqVersion

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.:

HTML Document Input:
<!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 20 Sep 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.

Setting

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.

Return

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

Remark

  • 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.

ReqVersion

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

HTML Document Input:
<!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

ID: 180400010 Last Updated: 4/10/2018 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019