Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> </head> <body> <p>该实例演示了如何使用 HTML DOM 向 input 元素添加 "oncopy" 事件。</p> <input type="text" id="myInput" value="尝试拷贝文本"> <script> document.getElementById("myInput").oncopy = function() {myFunction()}; function myFunction() { alert("你拷贝了文本!"); } </script> </body> </html>