Or you could try out this little quickie:
http://home.comcast.net/~jscheuer1/s...intcontent.htm
Code:
<!DOCTYPE html>
<html>
<head>
<title>Q&D Print Demo</title>
<script type="text/javascript">
function popPrint(element, css, css_url){ //function used to popup print the innerHTML of the passed in element
var html, printWin;
element = element.tagName? element : document.getElementById(element);
css = css || ""; //optionally add a default css
css = "<style type='text/css'>"+css+"</style>";
css_url = css_url || ''; //optionally add a default print stylesheet url to the popup
if ( css_url !== '' ) {
css_url = "<link rel='stylesheet' type='text/css' href='"+css_url+"' media='print' />";
}
html = '<html><head><title>'+(element.getAttribute('data-print-title') || '')+'</title>'+css+css_url+'</head>'+element.innerHTML+'</html>';
printWin = window.open('', '', 'left=100, top=100, width=600, height=400, toolbar=no, scrollbars=yes, status=yes' );
printWin.document.write(html);
printWin.document.close();
printWin.focus();
printWin.print();
printWin.close(); //not executed in Opera for some reason, user can manually close easily enough
}
</script>
</head>
<body>
<input type="button" value="Print" size="50" onclick="popPrint('print')" />
<div id="print" data-print-title="List One">
<ul>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
</div>
<input type="button" value="Print" size="50" onclick="popPrint('print1')" />
<div id="print1" data-print-title="List Two">
<ul>
<li>11</li>
<li>11</li>
<li>11</li>
</ul>
</div>
</body>
</html>
Or, perhaps this one would be better:
http://home.comcast.net/~jscheuer1/s...ntcontent2.htm
Code:
<!DOCTYPE html>
<html>
<head>
<title>Q&D Print Demo II</title>
<style type="text/css">
#printarea {display: none;}
</style>
<style type="text/css" title="copyprint" media="print">
#screencontent {display: none;}
#printarea {display: block;}
</style>
<script type="text/javascript">
function enabledisableprintstyle(which){
var sheets = document.getElementsByTagName('style'), i = sheets.length;
while(--i > -1){
if(sheets[i].title === 'copyprint'){
sheets[i].disabled = which;
break;
}
}
}
enabledisableprintstyle(true);
function copyPrint(element){ //function used to copy print the innerHTML of the passed in element
var savedtitle = document.title;
element = element.tagName? element : document.getElementById(element);
document.getElementById('printarea').innerHTML = element.innerHTML;
document.title = element.getAttribute('data-print-title') || '';
enabledisableprintstyle(false);
window.print();
document.getElementById('printarea').innerHTML = '';
document.title = savedtitle;
enabledisableprintstyle(true);
}
</script>
</head>
<body>
<div id="printarea"></div>
<div id="screencontent">
<input type="button" value="Print" size="50" onclick="copyPrint('print')" />
<div id="print" data-print-title="List One">
<ul>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
</div>
<input type="button" value="Print" size="50" onclick="copyPrint('print1')" />
<div id="print1" data-print-title="List Two">
<ul>
<li>11</li>
<li>11</li>
<li>11</li>
</ul>
</div></div>
</body>
</html>
Bookmarks