close()

In this chapter you will learn:

  1. How to close a window

window.close()

window.close() closes the window.

<!DOCTYPE HTML> <!-- ja va2  s  .c om-->
<html> 

    <body> 
        <script> 
            //window.close();  

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

Click to view the demo

Uncomment out the statement to see the action.

Next chapter...

What you will learn in the next chapter:

  1. How to show a conform 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()