/    Sign up×
Community /Pin to ProfileBookmark

Printing a web page problem using print()

Hi,

I have the following function…

[code]
function printFile(){
myprint.style.visibility=’hidden’;
window.print();
myprint.style.visibility=’visible’;
}

[/code]

The HTML code is…

[code]
<a href=”javascript:onClick=printFile()”>
<img id=”myprint” border=”0″ src=”//images/sm_print.gif” width=”70″ height=”21″></a>

[/code]

The problem is that it will print the gif image, at least in FireFox; IE prints it without the gif image. Is there something I can do to get the gif image NOT to print for both browsers?

Thanks…

I know it will not print if I don’t make the image visible again but I want the image back up there after printing if the window is left open!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Tweak4May 21.2007 — Instead of hiding and showing the image, it might be easier just to set up a separate stylesheet with a "print" media type, and then use CSS in that stylesheet to hide anything you don't want printed.
Copy linkTweet thisAlerts:
@Mike_BurdickauthorMay 21.2007 — Tweak4,

Hmmmm, that may be the way to go - need to think about that for a while. By the way, can I produce that page so it never shows up on the screen? As it is now the page I want printed is produced by a perl script on the fly.
×

Success!

Help @Mike_Burdick spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...