1

I've run into quite a problem. I have a page (http://centralsirescoop.com/proven-sires/cairnbrae-jaces-elton/index.php) which uses javascript to make the green bars adjust their length according to the data in the table next to it. All good there, but when I go to print the page, the bars don't show.

How do I go about printing a page with the javascript rendered?

Thank you.

Riley5
  • 15
  • 4

2 Answers2

0

Enable the option of Background Color and Images in print options which will make those bars to be printed.

By default , it won't print background color and images

Prasath K
  • 4,950
  • 7
  • 23
  • 35
  • 1
    That makes perfect sense! The Javascript was being run, it's just that the background colour wasn't being shown. Thank you very much! – Riley5 Aug 14 '13 at 10:55
0

Hi When you deactivate JavaScript and reload the page the page looks just as when javascript is not deactivated. So may be it's a css-problem, when you remove temporarily everything except of the content-div? But it is only guessed.

Recommendation one: print everything on the site not just the div.

Recommendation two: You can open a new window and put all content of your div into the new window.

function openElementPrintWindow(element){
    var strWindowFeatures = "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes";
    win = open('SIDE-URL','Print Content',strWindowFeatures);
    win.onload = function(){
      win.document.body.innerHTML = element.innerHTML;
      win.print();
    };
}

The most important part is that the SIDE-URL must reference on a side where css is appropriate ajusted for the content (div) that the window got (code: win.document.body.innerHTML = ...).

Hope this helps a little bit.

Blauharley
  • 4,186
  • 6
  • 28
  • 47