查找表单的目标(target)
- <!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>