HTML
CSS
JavaScript
Vue
React
Python
PHP
Java
.Net
Java9手册
PHP手册
CSS3手册
jQuery手册
源代码
在线运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(cainiaoplay.com)</title> </head> <body> <form id="myForm"> <fieldset id="myFieldset"> <legend>Personalia:</legend> 用户名: <input type="text"><br> Email: <input type="text"><br> 出生日期: <input type="text"> </fieldset> </form> <p>点击“尝试一下”按钮返回 fieldset 所属的表单的 id。</p> <p id="demo"></p> <button onclick="myFunction()">尝试一下</button> <script> function myFunction(){ var x = document.getElementById("myFieldset").form.id; document.getElementById("demo").innerHTML=x; } </script> </body> </html>
动行结果