javaScript window print method

the javascript window print() method open a print dialog to print the current document.

the print() method is supported in all major browsers.

syntax:

          window.print()
 <!doctype html>
 
     <html>
         
           <head>   <title> print the window document </title> 
           
               <script>
               
                        function     printdialog(){
                              
                                                           window.print();
                                            
                                                      }
              </script>                            
                                            
         </head>
           
             <body>
           
            <p><button   onclick="printdialog()">click here to print</button></p>
                   
        </body>
           
  </html>             

note : this is not a recommended way of giving printing facility for your online website.