控制文档过期,使用META标记,例:
<META HTTP-EQUIV="expires"
VALUE="Tue, 23 Jun 1998 01:46:05 GMT">
使用CSS的page-break-before,page-break-after进行打印控制
These two properties allow the developer to specify exact locations for page breaks that affect the printing of the document.
Property: page-break-before
Valid Values: auto and always and and left and right
Sample Usage:{ page-break-before:always; }
Applies to:block-level elements
Inherited?:no
Property: page-break-after
Valid Values: auto and always and and left and right
Sample Usage:{ page-break-before:auto; }
Applies to:block-level elements
Inherited?:no
对page-break-before和pageBreakBefore的详细介绍
page-break-before Attribute and pageBreakBefore Property
sBreak String that specifies one of the following values: always Always insert a page break before the object.
"" Empty string does not insert a page break.
The property is read/write with no default value; the cascading style sheets (CSS) attribute is not inherited.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.
Remarks
This property applies when printing the document.
If there are conflicts between this property and the pageBreakAfter value object previously displayed in the browser, the value that results in the largest number of page breaks is used.
Page breaks are not permitted inside positioned objects.
Example
The following examples use the page-break-before attribute and the pageBreakBefore property to start printing on a new page.
This example uses the H3 element as a selector in an embedded style sheet to break the page before all H3 headings.
Sample Code
<STYLE>
H3 { page-break-before: always }
</STYLE>
</HEAD>
<BODY>
<H3>Start New Section on New Page</H3>
This example uses a call to a function to turn off the page break before the object that has an id value of idParagraph. When the page is printed, a page break occurs before the first paragraph unless the user clicks the Turn Off Break button.
<SCRIPT>
function offBreak()
{
idParagraph.style.pageBreakBefore="";
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onClick="offBreak()">Turn off break</BUTTON>
<P ID="Paragraph" STYLE="page-break-before:always">
:
</P>