JS跨页调用打印

网上看见的一个方法,保留下来以供以后再看

A页面:

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


function fd1(){
    document.getElementById('print').src = "B.html ";
}

B页面:

<script  type="text/javascript"> 
function doPrint(){   
       window.focus();  //这个一定要有,否则打印的是A页面+B页面
       window.print();

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

</body>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章