天天看點

在ASP.NET2.0裡列印網頁指定的内容(比如列印網頁裡的一個Table)

列印指定内容:

<html>

<head>

<script   type= "text/javascript "   language= "javascript ">

function   printPage()   {

  var   newWin   =   window.open( 'about:blank ', ' ', ' ');

  var   titleHTML   =   document.getElementById( "doctitle ").innerHTML;

  newWin.document.write(titleHTML);

  newWin.document.location.reload();

  newWin.print();

}

</script>

</head>

<body>

<div   id= "doctitle ">

要列印的内容!

</div>

<a   href= "javascript:; "   onclick= "printPage() "> 列印 </a>

</body>

</html>

繼續閱讀