confirm()

In this chapter you will learn:

  1. How to show a conform dialog

window.confirm()

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

<!DOCTYPE HTML> <!--  ja v a  2s.  co m-->
<html> 

    <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

Next chapter...

What you will learn in the next chapter:

  1. How to show a find dialog
Home » Javascript Tutorial » Window
Window Object
alert()
close()
confirm()
find()
Window height and width
location
window.moveBy
window.moveTo
window.open()
window.print()
window.prompt()
resizeTo(x,y) and resizeBy(xDelta,yDelta)
window.scrollTo(x,y)
screenLeft, screenX, screenTop, screenY
setInterval()
setTimeout()