Link to home
Start Free TrialLog in
Avatar of JpmSoft
JpmSoft

asked on

How could I hide some elements on screen but not on printer?

I need to hide some DIV's on a page (style="display:none") but I'd like to print them when I call the script :

window.print();

If I use style="display:none" all of those DIV's are not printed...

Is It possible???

JpmSoft


SOLUTION
Avatar of Rahulkumar007
Rahulkumar007

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think all above will work fine.

Reagrds
Fahd Murtaza
Avatar of JpmSoft
JpmSoft

ASKER

Thanks to all of you guys!

Lets think about that situation:

What I'm designing is an HTML Reporting tool...
Each report with more than 1 page has a navigation bar to jump between pages.

All of this is working fine by using this method:

<DIV ID='PAGE_1' style='display:inline>
...
</DIV>
<DIV ID='PAGE_2' style='display:none'>
...
</DIV>

etc...

When I jump between pages I change the style.display property for each DIV element to their respective values.

This is just fine, but when I try to print,  those pages which are in state "display:none" are not being printed.

Now again...
How do you think I can make some pages not to be visible on screen but they can be printable at any time?

If I use ashleysdb's approach and set  up every <DIV> with 2 styles like:
<DIV ID='PAGE_1' class='print_visible_allways screen_visible'>
How could I change the screen_visible style when I want to show/hide a specific DIV (current page) ???


Thanks in advance!
JpmSoft


I'm not sure you would need to make that distinction when you set the display to none. The print style sheet may over-rule. Have you tried my method as it is already to see if it works?
If we are not geeing a response of what he says about his problem, then go on deleting it.
Regards,
Fahd Murtaza
Well I gave a working responce, so what more can we do?
Avatar of JpmSoft

ASKER

Hi guys,

Sorry by the late....

After all, no one of your recommendations works for me...

What I decided to do was show all printable DIV's with the javascript function where I start the printing process... this way all the pages in the report could be printed and supported by the printing dialog.

This is not much elegant, but it works.

JpmSoft

At least you should consider answers from ashleydb and others who worked for it.
Regards,
Fahd Murtaza