代码示例:(标识:event_oncopy_html)
<!DOCTYPE html>
<html>
<body>

<p>本例演示如何将 "oncopy" 事件分配给输入元素。</p>

<input type="text" oncopy="myFunction()" value="尝试复制此文本">

<script>
function myFunction() {
  alert("你复制了文本!");
}
</script>

</body>
</html>
运行结果: