|
| |
|
|
levins
Posts: 272 Joined: 12/12/2001 From: Hartland WI USA Status: offline
|
print page - not printing - 2/11/2008 14:00:12
I have a page that I want people to be able to to print. It is not working I put this script and inserted in the head section <script language="JavaScript"> var gAutoPrint = true; // Tells whether to automatically call the print function function printSpecial() { if (document.getElementById != null) { var html = '<HTML>\n<HEAD>\n'; if (document.getElementsByTagName != null) { var headTags = document.getElementsByTagName("head"); if (headTags.length > 0) html += headTags[0].innerHTML; } html += '\n</HE>\n<BODY>\n'; var printReadyElem = document.getElementById("printReady"); if (printReadyElem != null) { html += printReadyElem.innerHTML; } else { alert("Could not find the printReady function"); return; } html += '\n</BO>\n</HT>'; var printWin = window.open("","printSpecial"); printWin.document.open(); printWin.document.write(html); printWin.document.close(); if (gAutoPrint) printWin.print(); } else { alert("The print ready feature is only available if you are using an browser. Please update your browswer."); } } </script> And I put this in the body <div id="printReady"> The text I want to print is inside divide. </div> Why is the page not printing?
|
|
|
|
Larry M.
Posts: 2834 Joined: 2/20/2003 From: Greenville, South Carolina, USA Status: offline
|
RE: print page - not printing - 2/11/2008 14:10:43
Assuming you want visitors to click on a printer icon with an embedded hyperlink, use: javascript:window.print() for Location Make sure Target Frame = Same Frame
_____________________________
Larry M. Reality is the leading cause of stress among those few in touch with it
|
|
|
|
levins
Posts: 272 Joined: 12/12/2001 From: Hartland WI USA Status: offline
|
RE: print page - not printing - 2/11/2008 14:35:51
It's working Thanks!
|
|
|
|
levins
Posts: 272 Joined: 12/12/2001 From: Hartland WI USA Status: offline
|
RE: print page - not printing - 2/11/2008 15:16:47
It works but an error message is printed on the page. (the output page) The error is [an error occurred while processing this directive]
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|