element.oncopy

Table of contents

  1. 1. Summary
  2. 2. Syntax
  3. 3. Example
  4. 4. Notes
  5. 5. Specification
  6. 6. See also
Table of contents
  1. 1. Summary
  2. 2. Syntax
  3. 3. Example
  4. 4. Notes
  5. 5. Specification
  6. 6. See also

This content covers features introduced in Firefox 3.

« Gecko DOM Reference

Summary

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

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.

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.

Notes

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

Specification

Not part of specification.

See also

Tags (3)

Edit tags

Attachments (0)

 

Attach file