HTMLonafterprintイベント属性

❮HTMLイベント属性

ページの印刷が開始されたとき、または印刷ダイアログボックスが閉じられたときにJavaScriptを実行します。

<body onafterprint="myFunction()">

定義と使用法

onafterprint属性は、ページの印刷が開始されたとき、または印刷ダイアログボックスが閉じられたときに発生します。

ヒント: onafterprint属性は、多くの場合、 onbeforeprint属性と一緒に使用されます。


ブラウザのサポート

Event Attribute
onafterprint 63 Yes Yes Not supported Not supported

注: IE / Edgeでは、onafterprint属性は、印刷ダイアログボックスの後ではなく、前に表示されます。


構文

<element onafterprint="script">

属性値

Value Description
script The script to be run on onafterprint

技術的な詳細

サポートされているHTMLタグ: <本体>

関連ページ

HTML DOMリファレンス:onafterprintイベント


❮HTMLイベント属性