User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 455,990 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,762 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 3346 | Replies: 4 | Solved
Reply
Join Date: Dec 2007
Posts: 3
Reputation: hav is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hav hav is offline Offline
Newbie Poster

Help printing div that was hidden by javascript

  #1  
Dec 6th, 2007
just started playing around with CSS and find I have a weird little problem related to printing and hidden divs.

a page contains hidden divs (hidden on screen) - the page uses a print css file so that these divs will be printed when the page prints

there are also links to toggle these divs on/off in the screen display (the links are simple JS setting of the divs' display style)

so far so go - works fine

problem is that, if such div is opened and closed using the links, the (now re-hidden) div will no longer print when the page is printed. They will, of course, print if they are visible on the screen but will not print when hidden by the links.

example: oops - I removed this link because it was to a page on my site which seems against the rules?? yes?

I'm guessing this is related to when stylesheets are applied (as page loads) and I guess I could add a "Print" link or button that would be sure to set the display when printing - but I sort of hate that as a solution??

Any ideas or pointers? Thanks
Last edited by hav : Dec 6th, 2007 at 3:40 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 3
Reputation: hav is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hav hav is offline Offline
Newbie Poster

Re: printing div that was hidden by javascript

  #2  
Dec 7th, 2007
just as a quick followup in case this helps someone else - I fixed the problem by adding !important to the print.css clases.
Reply With Quote  
Join Date: Jul 2008
Posts: 2
Reputation: shellydsilva is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shellydsilva shellydsilva is offline Offline
Newbie Poster

Re: printing div that was hidden by javascript

  #3  
Jul 9th, 2008
I have three DIV tag in a web page and have hidden by JavaScript. I want to have all the three DIV content to be printed with a single print button.
Reply With Quote  
Join Date: Jan 2007
Posts: 2,604
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 119
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: printing div that was hidden by javascript

  #4  
Jul 10th, 2008
You can post links to pages showing the problem, or pages showing what you want to do.

You can't post links to attract people to your website.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jul 2008
Posts: 2
Reputation: shellydsilva is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
shellydsilva shellydsilva is offline Offline
Newbie Poster

Re: printing div that was hidden by javascript

  #5  
Jul 11th, 2008
Originally Posted by MidiMagic View Post
You can post links to pages showing the problem, or pages showing what you want to do.

You can't post links to attract people to your website.
I am trying to create the website using this sample website.
http://tutorials.mezane.org/tabbed-n...ion-using-css/

It has three DIV and using Javascript two DIV's would be hidden. The final output would be like tabbed window.

I need a print button in the page, and clicking on it should open a new wepage with all the three DIV contents displayed. So that while printing that webpage, will print all the contents of the three tabs.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 9:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC