Visit Mozilla.org

DOM:element.oncopy

From MDC

This article covers features introduced in Firefox 3

« Gecko DOM Reference

Contents

[edit] Summary

The oncopy property returns the onCopy event handler code on the current element.

[edit] Syntax

element.oncopy = functionRef;

where functionRef is a function - often a name of a function declared elsewhere or a function expression. See Core JavaScript 1.5 Reference:Functions for details.

[edit] Example

<html>
<head>
<title>oncopy event example</title>

<script>
  function log(txt)
  {
    document.getElementById("log").appendChild(document.createTextNode(txt + "\n"));
  }
</script>
</head>

<body>
<div oncopy="log('Copy blocked!'); return false;">Try copying this text!</div>

<h3>Log</h3>
<textarea rows="15" cols="80" id="log" readonly="true"></textarea>
</body>
</html>

This example prevents the text from being copied out of the browser window.

[edit] Notes

This event is sent when the user attempts to copy text.

[edit] Specification

Not part of specification.

[edit] See also