The use of MsgBox function and InputBox function in ASP

Source: Internet
Author: User
Tags numeric numeric value

The MsgBox function displays a message in a dialog box, waits for the user to click the button, and returns a value that instructs the user to click the button in the following syntax format:

MsgBox (Prompt[,buttons][,title][,helpfile,context])
Prompt: Specifies the string to display in the dialog box
Buttons: Specifies the number and type of display buttons, the icon style used, and the default value is 0 (parameters are shown in the table below)
Title: String displayed in the title bar of the dialog box
HelpFile: is a string that identifies the help file that provides context-sensitive Help for a dialog box
Context: is a numeric value that identifies the contextual number assigned to a Help topic by the author of the Help file

Example:

==================================================

<script language= "VBScript" >

Dim ans

Ans=msgbox ("Do you want to visit the small Lotus pond?", vbyesno+vbquestion, "hint info")

If Ans=vbyes Then

Window.navigate "Http://www.xxxx.net"

Else

document.write "Welcome to our site!" ”

End If

</script>

==================================================

The display effect is as follows:

The InputBox function displays a prompt in the dialog box, and so on, the user enters text or clicks the button and returns the contents of the text box.

InputBox (Prompt[,title][,default][,xpos][,ypos][,helpfile,context])
Prompt: Specifies the string to display in the dialog box
Title: String displayed in the title bar of the dialog box
Defaults: Default string displayed in a text box
Xpos: is a numeric value that specifies the distance between the left edge of the dialog box and the left edge of the screen, and if omitted, the dialog box is centered horizontally
Ypos: is a numeric value that specifies the distance between the top edge of the dialog box and the top edge of the screen, and if omitted, the dialog box appears in the vertical direction of the screen about 1/3 places below the edge
HelpFile: is a string that identifies the help file that provides context-sensitive Help for a dialog box
Context: is a numeric value that identifies the contextual number assigned to a Help topic by the author of the Help file

Example:

=================================================

<script language= "VBScript" >

Dim UserName

Username=inputbox ("Please enter your name:", "Enter the name", "Zhang Mowgli")

If username= "" Then

Document.Write "You did not enter a name. ”

Else

document.write "Welcome," & UserName & "Friends. ”

End If

</script>

=================================================

Results see the following figure:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.