打印视图中的动态内容页眉和页脚信息覆盖

时间:2017-05-09 12:44:50

标签: javascript php html css printing



function PrintPage() {
          document.getElementById('print').style.display = 'none';
          window.resizeTo(960, 600);
          document.URL = "";
          window.location.href = "";
          window.print();
      }

@page { size: auto;  margin: 2mm 4mm 0mm 0mm; }
.theadclass{top:0;position:fixed;display:block;height:100px;width:100%;border:solid 2px red;background-color:red;overflow:hidden;z-index:1;clear:both}.tfootclass{bottom:0;position:fixed;display:block;height:100px;clear:both;width:100%;border:solid 2px red;overflow:hidden;background-color:#000}

<form id="form1" runat="server">
 	<br clear="all"/>
  	<input type="button" id="print" name="print" value="Print" onclick="javascript:PrintPage();" class="button" />
   		<div class="theadclass"> header content here</div>
  	<div class="tbodyclass">
    	<?php 
        for ($i=0; $i < 150; $i++) { 
              echo "".$i."<br/>";
        }
        ?>
    </div>
 	<div class="tfootclass"> footer content here </div>
</form>
   

 
&#13;
&#13;
&#13;

0 个答案:

没有答案