W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <form id="frm1" action="/demo/demo_form.asp" target="_self"> 名:<input type="text" name="fname" value="Bill"><br> 姓:<input type="text" name="lname" value="Gates"><br><br> <input type="submit" value="提交"> </form> <p>点击“试一试”以显示表单的目标:</p> <button onclick="myFunction()">试一试</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("frm1").target; document.getElementById("demo").innerHTML = x; } </script> </body> </html>