views:

55

answers:

1

First, here’s the page question: http://www.tranzact.com/test/solution_freightfaqs.html

I used a simple “Print Page” function (below):

<a href="#" onclick="window.print();return false;">Print Page</a>

Below is the toggle.js script:

function toggle(theID) {
if(document.getElementById(theID).style.display=='none' ){
   document.getElementById(theID).style.display = '';}
else{
   document.getElementById(theID).style.display = 'none';}
}

This results with the page printing “as is.” That is, if none of the toggles are expanded, only the questions print out.

How can I make the print button automatically expand all of the answers when printing?

Appreciate any help given. Thank you.

A: 
<a href="#" onclick="print_page();return false;">Print Page</a>

<script>
function print_page(){
  var style = document.createElement('style');
  style.innerHTML = '#bodyContent div {display:block !important}';
  document.getElementsByTagName('head')[0].appendChild( style );
  window.print();
}
</script>
NV
Thanks, NV, but that didn't solve the problem. I tried to print in Firefox and IE and results are the same. Perhaps there is something inherent in the toggle script I am using that needs to be altered? I just don't know enough about Javascript. Thanks for the suggestion, though.
TranzAct