Confirm


The Confirm method presents a dialog window showing a prompt, and allows the user to choose between OK and Cancel.

It then returns with a value of True of OK choosen, or False if Cancel choosen.

The confirm method is most often used to check with the user before going on. For example, before loading a specific page (maybe one containg large images or frames) you could ask the user if they wanted it and then take appropriate action (choose not to load images or go to a no-frame version).

Try the following program out.

Note: You can copy the images from the course disk, or just put in a text message instead, or use the full path to the images given below.

http://www.dcs.uwaterloo.ca/~anderson/JavaScript/animated.gif
http://www.dcs.uwaterloo.ca/~anderson/JavaScript/static.gif

Run the program.

Back