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.
printing only selected section
Moderator: General Moderators
-
amrita2084
- Forum Newbie
- Posts: 6
- Joined: Tue Apr 01, 2008 6:04 am
Re: printing only selected section
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.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: printing only selected section
Moved to Client Side.
Re: printing only selected section
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
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:
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" />- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: printing only selected section
The easiest thing to do, when it comes to printing a page, is to use a print stylesheet. There is no need for javascript.