The confirm method is used to invoke a confirmation dialog box like this: if (confirm(“This is a confirmation box”)) alert(“You clicked OK”); else alert(“You clicked cancel”); This produces the traditional OK/Cancel dialog box, as you’ll see later in the chapter. The confirm method returns a value of true if the user clicks the OK button, and false if the user clicks the Cancel button. The prompt dialog box is invoked by using the prompt method of the window object. So, suppose you would like to ask the user what his or her name is and then present that as text in the page.
Beginning Ajax with ASP .NET by Wallace B. McClure