html print preview page


<! DOCTYPE HTML>
<HTML lang = "EN">
<head>
<Meta charset = "UTF-8">
<title> out of the ring than the statistical query </ title>
</ head>

<body>
<div class = " g0_container ">
<div class =" g0_ydpm_c "ID =" printdiv ">
<P> <span> <% = lastMonth%> </ span> to <span> <% = now% > </ span> out MoM statistics where </ P>
<Table class = "g0_table">
<thead>
<TR>
<TH> ID </ TH>
<TH> name </ TH>
<TH> January </ TH>
<TH> chain </ TH>
<TH> February </ th>
<TH> chain </ th>
<TH> March </ th>
<TH> chain </ th>
<th> April </ th>
<th> chain </ th>
<th> May </ th>
<th> chain </ th>
<th> June </ th>
<th> chain </ th >
<TH> July </ TH>
<TH> chain </ TH>
<TH> August </ TH>
<TH> chain </ TH>
<TH> September </ TH>
<TH> chain </ TH>
<TH> October </ TH>
<TH> chain </ TH>
<TH> November </ TH>
<TH>Chain </ TH>
<TH> December </ TH>
<TH> chain </ TH>
</ TR>
</thead>
<tbody id="resTable">
<tr>
<td>1</td>
<td>你发的分公司电饭锅</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
</tbody>
</table>
<div class="g0_btn_c" style="display: none">
<a href="###" class="g0_btn g0_mr_24" onclick="windowprint()">打印</a>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="<%=basePath%>/common/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/common/layer3.1/layer.js"></script>
<script type="text/javascript">

// 打印
function windowprint () { 
$ ( "g0_btn_c.") hide ();.
var headhtml = "<HTML> <head> <title> </ title> </ head> <body>";
var foothtml = "</ body > ";
// get the html content div
$ (" Rank-1. ") html. (" 1 ");
$ (." Rank-2 "). html (" 2 ");
$ (" Rank. -3. ") html (". 3 ");
var NewHTML = $ (" # printdiv ") html ();.
// Get the html content div, jquery written as
// var newhtml = $ (" # "+ the PrintPage) .html ();

// get the original html content window interface body and saved
var oldhtml = document.body.innerHTML;

// window interface to reassign, html content Fu own stitching together
document.body. innerHTML = headhtml + newhtml + foothtml;

// Call window.print method to print a new window
window.print ();

// body of the original window display html value backfill
document.body.innerHTML = oldhtml;
$(".rank-1").html("");
$(".rank-2").html("");
$(".rank-3").html("");
$(".g0_btn_c").show();
return false;
}
</script>
<script type="text/javascript" src="<%=basePath%>/common/js/jquery-1.9.1.min.js"></script>
</html>

Guess you like

Origin www.cnblogs.com/jdl1024/p/11576767.html