Forum Moderators: phranque
THe name of the layer is layer1. I am hoping that someone has come across this. I am trying to prevent having a separate "printer friendly" page. My content for printing is all on a layer, and I would like to print that content only, without printing everything else on the page.
thanks you,
Bob
<script type="text/javascript">
<!--
function printLayer(lname) {
var txt = document.getElementById(lname).innerHTML;
document.open();
document.write(txt);
document.close();
window.print();
// the previous line may need to be...
// document.print();
}
//-->
</script>
...
<div id="layer1">
Text is text, that's what it is. Text is text, that's what it is. Text is text, that's what it is. Text is text, that's what it is. Text is not speech, that's what it's not. Text is not speech, that's what it's not. Text is not speech, that's what it's not.
<a href="#" onclick="printLayer('layer1'); return false;">Print this layer</a>
<input type="button" value="Print this layer" onclick="printLayer('layer1');" />
</div>
I am not able to test this though, because I don't have a printer set up right now.
Jordan