• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Printing with DIV tags

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic