Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   javascript. window.print (https://www.cableforum.uk/board/showthread.php?t=43028)

grandmaster 13-02-2006 21:53

javascript. window.print
 
Good Evening Guys 'n' Gals.

Does anyone know how to print a table in Javascript.
window.print() prints the entire window,

I would only like to print a table within a page (a calendar to be more precise)

Any ideas??

Cheers

Ryan

punky 13-02-2006 22:19

Re: javascript. window.print
 
Easiest way to do it is to spawn a new window, write to it, print it, close it.

like this:

Code:


//Open a new window

newwin = open("","newwin","width=400, height=250, status=no, toolbar=no, menubar=no, scrollbars=yes");


//write to it

newwin.document.write('<html><body>');

//write table code here

newwin.document.write('<table>...</table>');

//write end code

newwin.document.write("<br><br><center><input type=button value='Close This Window' onClick='javascript:window.close();'></body></html>");

//try and close the window automatically

newwin.close();


grandmaster 14-02-2006 10:39

Re: javascript. window.print
 
Thanks. thats kind of what i did.

I created a blank webpage with just the calendar then made a java script pop up window with a print button.

Thanks for the reply a greenie for you!!

punky 14-02-2006 10:42

Re: javascript. window.print
 
Quote:

Originally Posted by grandmaster
Thanks. thats kind of what i did.

I created a blank webpage with just the calendar then made a java script pop up window with a print button.

Thanks for the reply a greenie for you!!

Thanx mate. Didn't think of that though! Don't ask me why oops:

Great minds also think vaguely alike too ;)


All times are GMT. The time now is 11:33.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum