How to show a confirm dialog

Description

confirm(msg) displays a OK/Cancel prompt dialog.

Example


<!DOCTYPE HTML> 
<html> 
<!--from   www .  j  a v  a 2s .c  om-->
    <body> 
        <script type="text/javascript"> 
            if (confirm("Are you sure?")) { 
                document.writeln("I'm so glad you're sure! "); 
            } else { 
                document.writeln("I'm sorry to hear you're not sure. "); 
            } 

        </script> 
    </body> 
</html>

Click to view the demo





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window