I implemented the following, seems to work just fine, netscape doesn't die at the
sight of it (of course it doesn't do anything in NS 4x or 6).
in <head>:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function prePrint() {
pagebody.innerHTML = contentText;
}
function postPrint() {
pagebody.innerHTML = bodyText;
}
//-->
</SCRIPT>
in <body>:
<body ... onBeforePrint="prePrint();" onAfterPrint="postPrint();" id="pagebody">
surrounding area you want to keep when printing:
<div id="pagecontent"> ... </div>
at bottom of page:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
var bodyText = pagebody.innerHTML;
var contentText = pagecontent.innerHTML;
//-->
</SCRIPT>
>>> Dave Watts <[EMAIL PROTECTED]> 07/01/02 02:32PM >>>
> This was in steve druckers presentation at CFUN, and I can't
> find the syntax anywhere.
>
> I need to know the style for stopping a bit of text from
> printing. For instance below, all of this would show on the
> screen but not on the printed page:
>
> <span style="...">Don't Print This</span>
> <span style="...">Do Print This</span>
If I recall correctly, you can do this by using the onbeforeprint and
onafterprint events of the document itself. You'd bind those event handlers
to the BODY tag, and have those event handlers programmatically hide and
show the elements you don't want to print. So, you might have something that
looks like this:
<body onbeforeprint="hideStuff();" onafterprint="showStuff();"> ...
Then, within the hideStuff function, you'd manipulate the styles of the
things you don't want to show, changing their "visible" property to hide
them, and you'd do the reverse in the showStuff function. I may be off on
some of the details, though, since it's been a while since I've looked at
this.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists