其實很簡單,用一個CSS就可以實現了,這個方法同時支持IE和FF。
HTML內容
XML/HTML Code復制內容到剪貼板
<HTML>
<HEAD>
<TITLE>Test Print</TITLE>
<STYLE type="text/css">
.css1 {
text-align: center;
text-align: center;
height: 250;
width: 400;
background-color: blue;
}
.css2 {
text-align: center;
height: 250;
width: 400;
background-color: red;
}
@media print {
.printbtn, .css1 {
display: none;
}
}
</STYLE>
</HEAD>
<BODY>
<DIV class="printbtn"><INPUT type="button" value="Print" onclick="window.print()"/> Print button can’t print out, But it can display in page.</DIV>
<DIV class="css1"><BR/><BR/><BR/>Not print out</DIV>
<DIV class="css2"><BR/><BR/><BR/>Print out</DIV>
新聞熱點
疑難解答