您的位置:首页 > 其它

web 页面打印在A页面点击打印按钮 打印出B页面(调用window内置的打印)

2010-06-20 14:29 417 查看
A页面核心代码:

<script type="text/javascript">

function print1(){

document.getElementById('print').src = "<%=request.getContextPath()%>/admin/print.jsp";

}

</script>

<input onclick = "print1()" type = "button" value = "print打印"> <br>

<iframe id="print" name="print" width = "0" height = "0" style = "display:"> </iframe>

B页面核心代码:

<script type="text/javascript">

function doPrint() {

window.focus(); //这个一定要有,否则打印的是A页面+B页面

window.print();

}

</script>

<body onload="javascript:doPrint()">

要打印的内容...

</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐