print preview code

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
izzysanime

print preview code

Post by izzysanime »

Hi,

Another question, Im looking for code that will print only specific parts of the page.  maybe put the content into a div tag?

Thanks
Josh
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm

Re: print preview code

Post by tsw »

create a print stylesheet which has something like

* {display:none}

#content {display:block;}
izzysanime

Re: print preview code

Post by izzysanime »

I tried using this

http://javascript.internet.com/miscella ... eview.html

but how do you specify what gets printed?
Kayin
Forum Members
Forum Members
Posts: 59
Joined: Mon Jun 05, 2006 2:33 am

Re: print preview code

Post by Kayin »

examples are meant to point you in the right direction, not give you the answer.

Use what was written above

* {display: none}
#content {display: block}

if you have different parts that you want to print....  what's the logical step here?

-K
izzysanime

Re: print preview code

Post by izzysanime »

I don't necessarily want the answer, but a little more direction.  what i have tried was giving the content i want printed a div id, but that does not work.  Is that what you meant? 

Thanks
Josh
Kayin
Forum Members
Forum Members
Posts: 59
Joined: Mon Jun 05, 2006 2:33 am

Re: print preview code

Post by Kayin »

You're using tables. Divs and tables act funny with each other because they're essentially trying to do the same thing just in different ways.

Keep messing with it, try different things like giving a table an id instead of using a div and then setting that to display:none;

-K
izzysanime

Re: print preview code

Post by izzysanime »

ok, this is starting to make much more sense, but now the print button does not do anything.  I gave the div an id and removed the table, and the css file has the id info set to none like you said.
Am I supposed to change the print button to something else?
 

Thanks
Josh
izzysanime

Re: print preview code

Post by izzysanime »

ok, i just realizsed i had to click the print button on the browser.  OK, i also changed my print button just to a standard print command.  So this is done, now need to fix other one remaining.

Thanks again Kayin for your help

Josh
Post Reply

Return to “The Lounge”