You are here: Reference > JavaScript > client-side > dialog > methods > print (window)

print method (window)

Browser support:
Prints the contents of the current window.
Use the media at-rule to customize the appearance of the printed pages and the print preview.
If you want to print the contents of a frame or iframe element, use the print method on the window object of the frame (see the contentWindow property).

Syntax:

object.print ( );
You can find the related objects in the Supported by objects section below.

Return value:

This method has no return value.

Example HTML code 1:

This example illustrates the use of the print method:
<head>
    <script type="text/javascript">
        function PrintDocument () {
            window.print ();
        }
    </script>
</head>
<body>
    <button onclick="PrintDocument ();">Print the entire document!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content