FUNCTION: InputBox( )
InputBox(Prompt,
Title, Default, Xpos,
Ypos, HelpFile, Context)
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.
There is one mandatory
arguments.
Prompt
The Prompt argument is the message string (question)
that appears
in the dialog box.
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 >
Output:
There are six optional
arguments.
Title
The optional Title argument is the title that appears at the top
of the dialog box window.
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 >
Output:
Default
The optional Default argument is the text that will appear in the
reply window in the dialog box.
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 >
Output:
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.
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
>
Output:
HelpFile
Context
The optional HelpFile argument specifies the location of the help
file.
The optional Context argument specifies the help context number
in the
help file.
Not demonstrated.