/    Sign up×
Community /Pin to ProfileBookmark

Javascript Printing

In my page i have 4 div and a navigation page to navigate through each division …ie each div tag is considered as a page

I want to add a print button in the navigaation page ,irrespective of which division i’m, it should print the whole html page…

I tried Window.print()..which prints only the current page…..Please guide

Thanks in advance

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_MooAug 29.2007 — I assume you are showing/hiding the divs with a script. If you want to print everything you will need to unhide all the divs, print, and then hide the inactive ones again.
Copy linkTweet thisAlerts:
@thambaAug 29.2007 — You could use a separate CSS file for print. This way in this print css file you can define all your divs to be visible. They will not be visible to the user, but when the user prints, all divs and their content will appear in the print page.

You can define it in your page using:

<link media="print" href="print.css" rel="stylesheet" type="text/css">

where media="print" states that this stylesheet file will be used when the page is printing.
×

Success!

Help @past123in 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...