在单独的页面中打印Javascript? [英] Print in separate page Javascript?
问题描述
我目前使用PHP并获取完整的用户详细信息并将其显示到html表中。我遇到的问题是当我打印3张表格时,每张表格都完美地打印在每页上。但是,当我尝试打印3张以上的表格时,每张表格都会向上移动,并且每张表格上都会部分打印表格(每页中有1½个用户详细信息)。
I am currently using PHP and getting complete user details and displays it into a html table. The problem that I have is when I print 3 tables each of them are printed on each page perfectly. But when I try to print over 3 tables, each table moves upwards and the tables are printed partially on each page (1 ½ user details in each page). I have given a fixed height for the table but still displays partially.
有人可以推荐一个Javascript,它将在一个页面上打印一个html表格吗?
Can someone please suggest a Javascript that will print a single html table in one page?
推荐答案
最好的方法是使用CSS。 CSS3的 page-break-after:总是
属性,您可以将其应用于您的表格(另请参见 http://www.w3schools.com/CSS/pr_print_pageba.asp )。请注意,不同浏览器对它的支持尚不足,但IE8和其他版本的其他浏览器应该支持它。
The best way to do this is using CSS. CSS3 has a page-break-after: always
property which you can apply to your table (see also http://www.w3schools.com/CSS/pr_print_pageba.asp). Note that its support by the different browsers isn't yet what it should be, but IE8 and current versions of the others should support it.
这篇关于在单独的页面中打印Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!