
当用户复制元素的内容时,oncopy 事件就会触发。
示例
您可以尝试运行以下代码以了解如何在 JavaScript 中实现 oncopy 事件。
<!DOCTYPE html>
<html>
<body>
<input type = "text" oncopy = "copyFunction()" value = "copy the text">
<script>
function copyFunction() {
document.write("Text copied!");
}
</script>
</body>
</html>

