The confirm box is similar to the alert box in appearance but has 2 buttons. The main difference is that true or false is returned depending on the button pressed.
Confirm boxes contain an Icon with an ? similar to the one above. The title bar of the box varies according the the browser used and cannot be changed. the same applies to button text. You can have multiple lines of text using \n where the new line starts.
I should point out that the only real problem with confirm boxes is the button text. Depending on the platform/operating system, the buttons are named either
(OK = true - Cancel = false) or (Yes = true - No = false)
Due to the button text your question must be applicable for both eventualities.
Basic syntax for the confirm box looks like this
confirm("Your message");
Time for an example
open the confirm boxThe Code
<script language="JavaScript" type="text/javascript">That's really all there is to know -
If true (OK or Yes) then do what ever you need to.
If false (Cancel or No) then do something else.
So in the final part we will put all of the boxes together in one demonstration: