编辑下面的代码:【加编码】
<html> <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>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂