It's not "javascript:print()". It's "window.print()".
Further, it's not onload="return PrintOrder()" as the onload event handler isn't cancellable. Instead, it should be onload="PrintOrder()".
This doesn't really address the original question of how to interact with the print dialog. The truth is that you can't, at least not with conventional web/scripting techniques. The only way I know of is via some manner of ActiveX.
Main Topics
Browse All Topics





by: dgrafxPosted on 2006-09-15 at 20:27:12ID: 17533860
This is an example of one scenario rprint.cfm ?OrderID=# OrderID#&p rint=true' );window.f ocus();ret urn false;">Print Order</a>
Lets say you want to print an order
So you provide a Print link
This link might be something like
<a href="" onclick="window.open('orde
Then on the page orderprint.cfm, you have a query that pulls all relevant data base on orderid you sent it.
you probably want to do a print stylesheet on this page thats different than your site stylesheet.
also remove links and "stuff" you don't want to print.
You can either remove them entirely or if you want to reuse files you can just do something like
<cfif Not isDefined("print")>
your links
</cfif>
You can then add a script (javascript) to open the windows print dialog
<script>
function PrintOrder() {
javascript:print();
window.close();
}
</script>
<body onload="return PrintOrder()">
When the window and print dialog is open, you'll be able to see what it looks like before printing.
I hope this helps ...