VBScript » Functions » InputBox

Version: 1.0

Syntax:
InputBox(Prompt, Title, Default, Xpos, Ypos, HelpFile, Context)
Prompt
The Prompt argument is the message string (question) that appears in the dialog box.
Title
The optional Title argument is the title that appears at the top of the dialog box window.
Default
The optional Default argument is the text that will appear in the reply window in the dialog box.
Xpos
The optional Xpos argument determines the horizontal position of the dialog box in the viewing screen. It is the number of twips from the left side of the screen to the left edge of the dialog box. Twips are a graphical value used to set the ScaleMode property of an object.
Ypos
The optional Ypos argument determines the vertical position of the dialog box in the viewing screen. It is the number of twips from the top of the screen to the top edge of the dialog box. Twips are a graphical value used to set the ScaleMode property of an object.
HelpFile
The optional HelpFile argument specifies the location of the help file.
Context
The optional Context argument specifies the help context number in the help file.

The InputBox function creates a prompt for an input dialog box.

The dialog box usually asks a question and prompts a reply from the user.

If the user clicks the OK button or presses ENTER, the InputBox function returns all text inside the text box. If the user clicks the CANCEL button, a zero-length string "" is returned.

Examples

Code:
< INPUT TYPE="BUTTON" NAME="button0" VALUE="Click Here!" >

< SCRIPT LANGUAGE="VBScript" >
Sub button0_onclick
Dim returntext
returntext = InputBox("This is an input box!")
End Sub
< /SCRIPT >
Language(s): VBScript
Code:
< INPUT TYPE="BUTTON" NAME="button1" VALUE="Click Here!" >

< SCRIPT LANGUAGE="VBScript" >
Sub button1_onclick
Dim returntext promptext
prompttext = "This is an input box!"
prompttext = prompttext (chr(13) chr(10))
prompttext = prompttext "We added a second line!"
returntext = InputBox(prompttext, "INPUT Function")
End Sub
< /SCRIPT >
Language(s): VBScript
Code:
< INPUT TYPE="BUTTON" NAME="button2" VALUE="Click Here!" >

< SCRIPT LANGUAGE="VBScript" >
Sub button2_onclick
Dim returntext promptext titletext
prompttext = "This is an input box!"
titletext = "INPUT function"
returntext = InputBox(prompttext, titletext, "Any text you wish...")
End Sub
< /SCRIPT >
Language(s): VBScript
Code:
< INPUT TYPE="BUTTON" NAME="button3" VALUE="Click Here!" >

< SCRIPT LANGUAGE="VBScript" >
Sub button3_onclick
Dim returntext promptext titletext
prompttext = "This is an input box!"
titletext = "INPUT function"
defaulttext = "Upper left corner"
returntext = InputBox(prompttext, titletext, defaulttext, 150, 150)
End Sub
< /SCRIPT >
Language(s): VBScript

See Also: