怎样在网页中加代码去掉页眉和页脚还有打印按钮?(在线等!!!谢谢!!!)
怎样在网页中加代码去掉页眉和页脚还有打印按钮?
我看了二篇文章,一篇幅只实现在了去掉去掉页眉,还要下载控件,代码如下:
<object id="factory" style="display:none" viewastext classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="http://www.meadroid.com/scriptx/ScriptX.cab#Version=5,60,0,360"></object>
<script defer>
function window.onload() {
factory.printing.header = ""
factory.printing.footer = ""
factory.printing.leftMargin = 0.75
factory.printing.topMargin = 1.5
factory.printing.rightMargin = 0.75
factory.printing.bottomMargin = 1.5
}
</script>
<p><input type="button" value="打印本页"
onclick="factory.printing.Print(false)">
<input type="button" value="页面设置"
onclick="factory.printing.PageSetup()">
<input type="button" value="打印预览"
onclick="factory.printing.Preview()">
<br>
这个能去掉打印按钮,代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
function doPrint()
{
var str = document.all.PrintBody.innerHTML;
dayin.style.display ="none";
document.open();
document.write(str);
window.print();
document.close();
window.close();
}
</script>
<body>
<table width="400" border="0" cellspacing="1" cellpadding="0" id="PrintBody">
<tr>
<td>123456</td>
</tr>
<tr>
<td>789787</td>
</tr>
</table>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center"><input type="button" value="打印" name="dayin" id="dayin" onclick="javascript:doPrint();" ></td>
</tr>
</table>
</body>
</html>
你试了把二个代码合在一起用,但还是不能实现,去掉页眉和页脚还有打印按钮,请高手指教,谢谢!