Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Gábor Papp
Added: Feb 11, 2018 7:31 AM
Views: 19
Tags: no tags
  1. function nyomtatas(elem) {
  2.     var mywindow = window.open('', 'PRINT', 'height=600,width=600');
  3.     mywindow.document.write('<html><head><title>' + document.title  + '</title>');
  4.     // mywindow.document.write('<link href="/design/mindenki/css/nyomtatas.css?7" rel="stylesheet">');
  5.     mywindow.document.write('<style type="text/css">');
  6.     mywindow.document.write('BODY { font-size: 16px; }');
  7.     mywindow.document.write('H1, H2 { color: #000000; }');
  8.     mywindow.document.write('.noprint { display: none; }');
  9.     mywindow.document.write('IFRAME { display: none; }');
  10.     mywindow.document.write('IMG { max-width: 100%; }');
  11.     mywindow.document.write('</style>');
  12.     mywindow.document.write('</head><body >');
  13.     mywindow.document.write('<h1>' + document.title  + '</h1>');
  14.     mywindow.document.write(document.getElementById(elem).innerHTML);
  15.     mywindow.document.write('</body></html>');
  16.     mywindow.document.close(); // necessary for IE >= 10
  17.     mywindow.focus(); // IE >= 10
  18.     mywindow.print();
  19.     mywindow.close();
  20.     return true;
  21. }