当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM form 属性
The form property returns a reference to the dropdown list's parent form.
form属性可返回下拉列表的父表参考
selectObject.form |
<html> <head> <script type="text/javascript"> function showFormId() { alert(document.getElementById("mySelect").form.id) } </script> </head> <body> <form id="myForm"> <select id="mySelect"> <option>Apple</option> <option>Pear</option> <option>Banana</option> <option>Orange</option> </select> <input type="button" onclick="showFormId()" value="Show the form's id"> </form> </body> </html> |
Get the id of the form that contains the dropdown list
得到下拉列表的所在表单的id