当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM form 属性
The form property returns a reference to the form that contains the option object.
form属性可返回包含option对象的表单参考
optionObject.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