<!DOCTYPE html> <html> <body> <p oncopy="myFunction()">尝试复制此文本</p> <script> function myFunction() { alert("你复制了文本!"); } </script> </body> </html>