"Confirm" dialog box

Source: Internet
Author: User

1. Insert the following code between

<Script>
Function rusure ()
{  
Question = confirm ("Are you sure you want to enter? ")
If (question! = "0 ")
{
Window. open ("", "test announcement window", "width = 340, height = 163, toolbar = 0, status = 0, menubar = 0, resize = 0 ");
}
}
</Script>

2. Add the onclick () statement to the link label:

<A href = "" onClick = "rusure (); return false;"> Click me </a>

The implementation method is two steps. First, insert the JavaScript code in the source code paste box to the

This method can also be used in other places. For example, if a "submit" button is added with a confirmation dialog box, it will give the submitter a chance to repent. There are several standard dialogs provided by JavaScript. We will list them in the following table for your reference.


Name and usage

Usage explanation
Return value
Confirmation dialog box:
Re = confirm ("confirm information ")
Select "OK" or "cancel" and use the return value to control the response. True or false
(True/False)

Warning dialog box:
Alert ("warning ")

Only one warning. Click "OK" to automatically disappear. No return value
Input dialog box:
Re = prompt ("Question", "default answer ")
Return the information entered by the user and perform the next step. Text string or null value entered by the user
</
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.