取得包含该下拉列表的表单的 id
- <html>
- <body>
- <form id="myForm">
- <select id="mySelect">
- <option>苹果</option>
- <option>桃子</option>
- <option>香蕉</option>
- <option>桔子</option>
- </select>
- </form>
- <p>该表单的 id 是:
- <script type="text/javascript">
- document.write(document.getElementById("mySelect").form.id)
- </script>
- </p>
- </body>
- </html>