HTML DOM id 属性
定义和用法
id 属性可设置或返回确认按钮的 id。
语法
- submitObject.id=id
实例
下面的例子可提示出确认按钮的 id:
- <html>
- <head>
- <script type="text/javascript">
- function alertId()
- {
- alert(
document.getElementById("submit1").id
)- }
- </script>
- </head>
- <body>
- <form>
- <input type="submit" id="submit1" onclick="alertId()" />
- </form>
- </body>
- </html>