/

HTML / CSS / JavaScript Tutorial

HTML Event attribute: onafterprint

[this page | pdf | back links]

The HTML onafterprint attribute specifies the event that is triggered after a document is printed. It applies to <body> elements.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body onafterprint="myOnafterprint()">
onafterprint: try printing page<br>

<script>
function myOnafterprint() {alert("Page being printed");}
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile