获取包含下拉列表的表单的 id
- <html>
- <body>
- <form id="myForm">
- <select id="mySelect">
- <option>Apple</option>
- <option>Pear</option>
- <option>Banana</option>
- <option>Orange</option>
- </select>
- </form>
- <p>这个下拉列表的 id 是:
- <script type="text/javascript">
- document.write(document.getElementById("mySelect").id)
- </script>
- </p>
- </body>
- </html>