This question should have gone to
javascript_official. Java and JavaScript
are totally different languages.
But be that as it may, there is really
no way to disable printing in JavaScript.
Basically, if you can see it, you can
print it. A determined user can just do
a screen capture and print the results.
But the easiest way to discourage printing
is with styles:
@media.screen {
// all your regular styles go here.
}
@media.print {
body { display: none; }
}
Haven't actually tried this, you might have to
include all the other tags you use, too, but
I doubt it.