源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <h1>使用 JavaScript 修改 pointer-events 属性</h1> <p>点击以下按钮修改 DIV1 元素的 pointer-events 属性:</p> <button onclick="myFunction()">点我</button> <div id="div1">访问 <a href="https://www.248k.com/">菜鸟教程</a></div> <script> function myFunction() { document.getElementById("div1").style.pointerEvents = "none"; } </script> </body> </html>
运行结果: