Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | javascript. window.print

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > Internet Discussion

javascript. window.print
Reply
 
Thread Tools
Old 13-02-2006, 21:53   #1
grandmaster
Inactive
 
grandmaster's Avatar
 
Join Date: May 2005
Location: Nr Manchester
Age: 48
Posts: 1,109
grandmaster has reached the bronze age
grandmaster has reached the bronze agegrandmaster has reached the bronze agegrandmaster has reached the bronze age
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
grandmaster is offline   Reply With Quote
Advertisement
Old 13-02-2006, 22:19   #2
punky
Inactive
 
Join Date: Jun 2003
Age: 45
Posts: 14,750
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
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();
punky is offline   Reply With Quote
Old 14-02-2006, 10:39   #3
grandmaster
Inactive
 
grandmaster's Avatar
 
Join Date: May 2005
Location: Nr Manchester
Age: 48
Posts: 1,109
grandmaster has reached the bronze age
grandmaster has reached the bronze agegrandmaster has reached the bronze agegrandmaster has reached the bronze age
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!!
grandmaster is offline   Reply With Quote
Old 14-02-2006, 10:42   #4
punky
Inactive
 
Join Date: Jun 2003
Age: 45
Posts: 14,750
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
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

Great minds also think vaguely alike too
punky is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 17:28.


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