File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Printing with DIV tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Printing with DIV tags" Watch "Printing with DIV tags" New topic

Printing with DIV tags

M Suguna
Ranch Hand

Joined: Jun 07, 2002
Posts: 37
I have the follwing HTML page.

This code produces a table with 4 rows. Only a part of the table will be visible (say, 2 rows) and the user has to use the scroll bar to view the remaining part of the table.
There is also a Print button in the page which calls window.print()
The problem is, window.print() prints only the visible part of the table (the top 2 rows). I want to print the entire table, when the print button is pressed.
Is there a way to achieve this?

Who says nothing is impossible? I've been doing nothing for years
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
what you will need to do is make the table bigger when the button for print is pushed.... Here is an example I just wrote up. I did not test it in Netscape,,,,only IE
function ChangeIt(){
if (document.getElementById) {document.getElementById(wlayer).style.height=200;}
else if (document.all) {document.all[wlayer].style.height=200;;}
else if (document.layers) {document.layers[wlayer].height=200;}
<table id="ViewTable" style="height:50" border='1'>
<input type="button" on_click="ChangeIt()" name="butt" value="Make Bigger">

Remeber to change on_click
I agree. Here's the link:
subject: Printing with DIV tags
It's not a secret anymore!