Page 1 of 1
printing only selected section
Posted: Thu Apr 10, 2008 7:32 am
by amrita2084
hi every1
i would like to know how to print only selected section in a page using javascript? the values to b printed is retrieved from database using php and mysql. so how to print only those content instead of the whole page.
any kind of help will be appreciated.
thanks in advance.
Re: printing only selected section
Posted: Thu Apr 10, 2008 12:32 pm
by Jade
I'm not exactly sure what you mean. It sounds like you're trying to use AJAX but I'm not quite sure. You can hide parts of a page (even if the page is there) using CSS and the div and layer hidden properties as well.
Re: printing only selected section
Posted: Thu Apr 10, 2008 3:35 pm
by RobertGonzalez
Moved to Client Side.
Re: printing only selected section
Posted: Thu Apr 10, 2008 3:43 pm
by JellyFish
What do you mean by printing? Do you mean like printing paper? If you mean printing paper, then I don't think there's anyway for you to control if the client wants to print the entire page or the selected part.
Re: printing only selected section
Posted: Fri Apr 11, 2008 9:49 am
by Sindarin
I think he means to select a region xmin,xmax,ymin,ymax and print that instead of the whole page.
I am not sure, but you could try a combination of css and ajax.
Otherwise if you're not looking for something dynamic, you could go with css as mentioned or even try placing the following <link> tag in your document head:
Code: Select all
<link rel="alternate" media="print" href="printing-region.html" />
Re: printing only selected section
Posted: Fri Apr 11, 2008 11:02 am
by RobertGonzalez
The easiest thing to do, when it comes to printing a page, is to use a print stylesheet. There is no need for javascript.