Hello all,
I'm not a javascript programmer and this is very simple - I know but I really dont know what to do here. I know you can help!
I have the following code and I need 'something' added to close the browser window after the print has completed.
<code>
<script type="text/javascript">
var pwin;
function printImg(printOption) {
var imageToPrint = document.getElementById("imgMain").src;
var html = imageToPrint;
if (printOption == 'option2') {
html = '<html><head><style type="text/css">img { float: left; margin: 0; padding: 0;}</style></head><body>';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<br clear="both">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '</body></html>';
pwin = window.open('', "_blank");
pwin.document.write(html);
pwin.document.close();
} else {
pwin = window.open(html, "_blank");
}
setTimeout("pwin.print()" ,20);
}
</script>
</code>
Thankyou for your help!
I'm not a javascript programmer and this is very simple - I know but I really dont know what to do here. I know you can help!
I have the following code and I need 'something' added to close the browser window after the print has completed.
<code>
<script type="text/javascript">
var pwin;
function printImg(printOption) {
var imageToPrint = document.getElementById("imgMain").src;
var html = imageToPrint;
if (printOption == 'option2') {
html = '<html><head><style type="text/css">img { float: left; margin: 0; padding: 0;}</style></head><body>';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<br clear="both">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '<img src="' + imageToPrint + '" alt="" width="105" height="57">';
html += '</body></html>';
pwin = window.open('', "_blank");
pwin.document.write(html);
pwin.document.close();
} else {
pwin = window.open(html, "_blank");
}
setTimeout("pwin.print()" ,20);
}
</script>
</code>
Thankyou for your help!