代码
<
html
>
< head >
< title ></ title >
< script type ="text/javascript" >
function printPage() {
var newWin = window.open( ' about:blank ' , '' , ' toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=yes ' );
// newWin.moveTo(100,100);
var titleHTML = document.getElementById( " printdiv " ).innerHTML;
newWin.document.write(titleHTML);
newWin.document.location.reload();
newWin.print();
// newWin.close();
}
</ script >
</ head >
< body >
< div id ="printdiv" >
< table class ="sontable" cellspacing ="0" cellpadding ="0" style ="width: 13%" >
< tr >
< td >
</ td >
</ tr >
< tr >
< td > 打印此div中的内容,加入Gridview.
</ td >
</ tr >
</ table >
</ div >
< a href ="javascript:;" onClick ="printPage()" > 打印 </ a >
</ body >
</ html >
< head >
< title ></ title >
< script type ="text/javascript" >
function printPage() {
var newWin = window.open( ' about:blank ' , '' , ' toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=no,resizable=yes ' );
// newWin.moveTo(100,100);
var titleHTML = document.getElementById( " printdiv " ).innerHTML;
newWin.document.write(titleHTML);
newWin.document.location.reload();
newWin.print();
// newWin.close();
}
</ script >
</ head >
< body >
< div id ="printdiv" >
< table class ="sontable" cellspacing ="0" cellpadding ="0" style ="width: 13%" >
< tr >
< td >
</ td >
</ tr >
< tr >
< td > 打印此div中的内容,加入Gridview.
</ td >
</ tr >
</ table >
</ div >
< a href ="javascript:;" onClick ="printPage()" > 打印 </ a >
</ body >
</ html >