Quackit Logo
$1.99 Domain Names
With every new non-domain purchase thru ZappyHost, you get a domain name for only $1.99.
Create free Flash websites

JavaScript Confirm

Print Version

The JavaScript confirm box gives your users a chance to confirm an action before JavaScript runs it. The 'confirm' box is created using JavaScript's built-in confirm() function. When the JavaScript confirm() function is triggered, a small box will pop up and display an "OK" button and a "Cancel" button (along with text that you specify in your JavaScript code).

Creating/Triggering a JavaScript Confirm

As mentioned, you create a JavaScript confirm box by calling the built-in JavaScript confirm() function. All you need to do is pass your message to this function.

Basic JavaScript Confirm

You can place the JavaScript confirm() function straight into an HTML tag. Like this:

JavaScript 'confirm()' Within Another Function

The above example works, but it doesn't really do much. You could make your website more useful by including the confirm() function within another function.

Here's an example:

Visit one of these excellent websites:

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
$7.49 .com domain names!
© Copyright 2000 - 2010 Quackit.com