This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Printing with DIV tags" Watch "Printing with DIV tags" New topic
Author

Printing with DIV tags

M Suguna
Ranch Hand

Joined: Jun 07, 2002
Posts: 37
Hi
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
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
<script>
function ChangeIt(){
wlayer="ViewTable";
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;}
}
</script>
<table id="ViewTable" style="height:50" border='1'>
<tr><td><form>
<input type="button" on_click="ChangeIt()" name="butt" value="Make Bigger">
</form></td></tr>
</table>

Remeber to change on_click
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing with DIV tags
 
Similar Threads
How to Detect the Highlighted Row Has Reached the Top of a Table?
Firefox problem when showing/hiding table rows
Table with Scrollbar
Creating CSS class at runtime
jquery script not executing on the data values that are extracted from the database