window.print()

In this chapter you will learn:

  1. Show the print dialog in Javascript

window.print() prompts the user to print the page. The print dialog is displayed asynchronously, returning control to the script immediately.

<!DOCTYPE HTML> <!--  jav  a2 s .  c o m-->
<html> 
    <body> 
        <script> 
            window.print(); 

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

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. Show the prompt() 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()