JavaScript Confirmation Box

JavaScript can display a nice confirmation box that will allow your script to test user’s choice when necessary.

The JavaScript “confirm” result is of type boolean. The following example should clear things for you:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
var yesorno = confirm("Do you like PHP?");
 
if( yesorno )
{
    alert("You like PHP, great...");
}
else
{
    alert("Don't like it? Nobody cares anyway.");
}
  • Share/Bookmark

Tags: , , ,

Tuesday, May 13th, 2008 JavaScript

Leave a Reply

You must be logged in to post a comment.