Overload of confirm method in Javascript

Source: Internet
Author: User
<Script language = JavaScript>
Function window. Confirm (STR ){
STR = Str. Replace (/'/g, "' & CHR (39) & '"). Replace (/|/g, "' & vbcrlf &'");
ExecScript ("n = msgbox ('" + STR + "', vbretrycancel, 'infotip ')", "VBScript", 0 );
Return (n = 6 );
}

</SCRIPT>

the desired system button is displayed. the key is the second parameter of msgbox. it can have multiple, connected with the or keyword.
the constant parameter list of msgbox is as follows:
The following constants are used with the msgbox function to identify the buttons and icons that appear in the message box and specify the default buttons. You can also specify the message frame style. Because these constants are created in VBScript, you do not need to define them before use. You can use Code to indicate the value.
constant value description
vbokonly 0 only displays the OK button.
vbokcancel 1 displays the OK and cancel buttons.
vbabortretryignore 2 displays the terminate, retry, and ignore buttons.
vbyesnocancel 3 displays the "yes", "no", and "cancel" buttons.
vbyesno 4: display the buttons "yes" and "no.
vbretrycancel 5 displays the retry and cancel buttons.
vbcritical 16 displays the critical message icon.
vbquestion 32 displays the warning inquiry icon.
vbexclamation 48 displays the warning message icon.
vbinformation 64 displays the message icon.
vbdefaultbutton1 0 the first button is the default button.
vbdefaultbutton2 256 the second button is the default button.
vbdefaultbutton3 512 the third button is the default button.
vbdefaultbutton4 768 the fourth button is the default button.
vbapplicationmodal 0 applies the Program mode. The user must respond to the message box to continue working in the current application.
vbsystemmodal 4096 system mode. In the Win16 system, all applications will be aborted until the user responds to the message box. In Win32 systems, this constant provides an application mode information box and always keeps it at the top of all other programs that you may be running.

The following constants are used with the msgbox function to identify the buttons selected by the user. The constants can be used only when the Type Library contains the following constant definitions that have been explicitly referenced in your project file. For VBScript, these constants must be explicitly declared in the code.

Constant Value description
Vbok 1 OK button is clicked.
The vbcancel 2 cancel button is clicked.
Vbabort 3 is clicked.
The vbretry 4 Retry button is clicked.
Vbignore 5 ignored button is clicked.
Vbyes 6 is the button clicked.
Vbno 7 no button is clicked.

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.