javascript - How to print popup window contents -


i have tried following:

<button onclick="window.print()" class="uk-button uk-float-left"><?php echo jtext::_('com_cstudomus_imprimir'); ?></button> 

also:

self.print()

window.focus();window.print()

when click on print shows main window , popup window in page going printed. need contents of popup window.

this example of print popup:

<div class="contentsection">     <div class="contenttoprint">         <!-- content printed here -->     </div> </div>  <div class="contentsection">     <a href="#" id="printout">print this</a> </div>  <div class="contentsection termstoprint">     <h4>terms & conditions</h4>     <p>management reserves right withdraw, amend or suspend print job in event of unforeseen circumstances outside reasonable control, no liability third party.</p> </div>  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>  <script type="text/javascript">     $(function(){         $('#printout').click(function(e){             e.preventdefault();             var w = window.open();             var printone = $('.contenttoprint').html();             var printtwo = $('.termstoprint').html();             w.document.write('<html><head><title>copy printed</title></head><body><h1>copy printed</h1><hr />' + printone + '<hr />' + printtwo) + '</body></html>';             w.window.print();             w.document.close();             return false;         });     }); </script> 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -