我有多个iFrame,每个iFrame都有一个唯一的打印按钮。调用打印时,iFrame中的所有图像都会在IE中打印。在Safari,Chrome和Firefox中正常运行。下面的代码:
<div class="col-12 col-md-6">
<iframe style="display:none;"
src="images/HM/Sweet-William-4-Pnt.png"
name="sweetwilliamframe" id="sweetwilliamframe">
</iframe>
<div class="text-center">
<input type="submit" class="btn btn-print mb-1"
onclick="frames[0].focus();frames[0].print();"
value="Print Sweet William Plans">
<p>
<img class="img-hm-plans"
src="images/HM/Sweet-William-4.png"
alt="Sweet William"
/>
</p>
</div>
</div>
<div class="col-12 col-md-6">
<iframe style="display:none;"
src="images/HM/Rose-Mallow-5-Pnt.png"
name="roseframe" id="roseframe">
</iframe>
<div class="text-center">
<input type="submit" class="btn btn-print mb-1"
onclick="frames[1].focus();frames[1].print();"
value="Print Rose Mallow Plans">
<p>
<img class="img-hm-plans"
src="images/HM/Rose-Mallow-5.png"
alt="Rose Mallow"
/>
</p>
</div>
</div>