[英]print a specific div using javascript
我正在使用可打印特定div的javascript代码。此代码工作正常,但在我打印时会自动显示页眉网址和页脚...我可以通过chrome浏览器来处理它,但不能通过ie或firefox.please帮助
<script language="javascript" type="text/javascript">
function printDiv() {
var divElements = document.getElementById('print_id').innerHTML;
var oldPage = document.body.innerHTML;
document.body.innerHTML ="<html><head><title>Booking</title> </head><body>"+divElements+"</body></html>" ;
window.print();
document.body.innerHTML = oldPage;
}
</script>
<script type="text/javascript">
function printDiv() {
var printContents = document.getElementById('Your printable div').innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.