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).


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:
    <script type="text/javascript">
        function PrintDocument () {
            window.print ();
    <button onclick="PrintDocument ();">Print the entire document!</button>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content