简单教程
提交运行
代码编辑器:
<script> function displayResult(){ var x=document.getElementById("button1").form.id; alert(x); } </script> <form id="form1"> <input type="button" onclick="displayResult()" value="显示包含按钮的表单id" id="button1"> </form>
运行结果: