PrintDocument

Aus Programmers Guide

Wechseln zu: Navigation, Suche
<script type="javascript">
/**
 * Der inhalt des übergebenen Dokuments wird gedruckt
 * 
 * Benötigt wird das scriptaculous-Framework
*/
function printDocument(uebergabe){
	var printContent = $(uebergabe);
	var windowUrl = 'about:blank';
	var num;
	var uniqueName = new Date();
	var windowName = 'Print' + uniqueName.getTime();
	var printWindow = window.open(num, windowName, 'left=0,top=0,width=600,height=400');
 
	printWindow.document.writeln('<html>');
	printWindow.document.writeln('<head><title>Druckansicht</title></head>');
	printWindow.document.writeln('<body><table id="editorTable" width="600">');
	printWindow.document.writeln(printContent.innerHTML);
	printWindow.document.writeln('</table></body></html>');
	printWindow.document.close();
	printWindow.focus();
	printWindow.print();
	printWindow.close();
}
</script>
Persönliche Werkzeuge