<script type="text/javascript">
function printDoc() {
document.getElementById("frame_singleCheque").contentWindow.print();
}
</script>
<iframe style ="height:400px; width: 750px; overflow:scroll;" id="frame_singleCheque" src="http://www.w3schools.com"></iframe>
<input type="button" id = "btnCPrint" value = "Print" onclick="javascript:printDoc()" />
エラー
[16:41:44.054] Error: Permission denied to access property 'print' @ http://localhost/pdf/print.php:3
iframe コンテンツを印刷するための多くのスタック推奨スレッドで確認しました。しかし、私にとってはそれらはうまくいきません。
上記のコードは、print.php ファイルにのみ存在します。iframe コンテンツを印刷したい。
また、iframe 内に存在する特定の div を印刷する方法も知りたいです。この iframe の例 " class = 'example_code notranslate' " .