<!DOCTYPE html>
<html>
<body>

<p>Try to copy the image below.</p>

<img src="w3javascript.gif" oncopy="myFunction()" width="100" height="132">

<p><strong>Note:</strong> This example may not work as expected in some browsers.</p>

<script>
function myFunction() {
    alert("You copied image!");
}
</script>

</body>
</html>