This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to hide the image from the HTML document? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to hide the image from the HTML document?" Watch "How to hide the image from the HTML document?" New topic

How to hide the image from the HTML document?

Ashwani Yadav
Ranch Hand

Joined: May 23, 2002
Posts: 33
I am generating an HTML document and in that document only I put the image to print that document.
What I want is once the user clicks on that image to print the HTML document that image should not be printed along with the HTML document.
Is it possible to do so and if yes how can I achieve this?
Garann Means
Ranch Hand

Joined: Jan 28, 2002
Posts: 214
One suggestion:
If you're printing using JavaScript, try a function like this that is called "onClick":

Something like that ought to work. Good luck!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60765

Two ideas off the top of my head:
1) Originally set a CSS attribute of display:block on the image, then just before you fire off the print operation, set it to display:none. This may not work in all of the browsers you may need to support.
2) Almost all browsers allow you to swap out images. Just before printing, swap out the image with one that's either transparent or a flood of the page background color.
[ July 10, 2002: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How to hide the image from the HTML document?
Similar Threads
Applet is not getting loaded in client machine
problem in accesing image in word
problems in showing images in jsp with contentType= application /msword
embedding images in HTML
Print Document