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>

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