JS Getting Started Tutorial: confirmation dialog box confirm

Source: Internet
Author: User

Confirmation dialog box confirm, when we write the program often encounter before the user click to save the deletion of the prior to a confirmation dialog box, which can enhance the user experience can also prevent errors or not small delete action, to the user brought some convenience. This command is our confirm oh.

Confirm syntax

Confirm (Message)

Let's look at a couple of two simple examples.

<a href=# onclick= "javascript:confirm (' Are you sure you want to delete the record? ', ' del.php?id=1 ');

That way, when the user clicks, you're prompted, "Are you sure you want to delete the record?"

OK, let's look at a simpler example of confirm.

<script type= "Text/javascript" >
function Disp_confirm ()
{
var r=confirm ("Clicked on Me")
if (r==true)
{
document.write ("Success!")
}
Else
{
document.write ("Canceled!")
}
}
</script>

See the top of it.

<input Type=bottun onclick= "Javascript:return disp_confirm ();" >

This is when you click on the time there will be a confirmation box, the click is really prompted "success" is "Canceled"

Original site: www.111cn.net

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.