编程教程 - 技术改变世界
编程教程提供了 JS 在线测试工具,可在线测试 JavaScript 代码,你可以在代码编辑器中输入 JavaScript 代码并点击运行查看结果。
源代码
点击运行
<!DOCTYPE html> <html> <body> <h3>演示如何访问 DETAILS 元素</h3> <details id="myDetails"> Some additional details... </details> <p>点击按钮来显示额外的细节。</p> <button onclick="myFunction()">试一下</button> <script> function myFunction() { var x = document.getElementById("myDetails"); x.open=true; } </script> </body> </html>
运行结果