form

阅读:26      收藏:0      [点我收藏+]

Button form 属性


定义和用法

form 属性可返回对包含该按钮的表单的引用。

如果包含该按钮,则返回一个 form 对象,如果未包含该按钮,则返回 null。

语法

buttonObject.form


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 form 属性。


实例

下面的例子可返回该按钮所属的表单的 id:

<html>
<body>

<form id="form1">
<button id="button1" type="button">Click me!</button>
</form>

<p>The id of the form containing the button is:
<script>
document.write(document.getElementById("button1").form.id);
</script></p>

</body>
</html>

关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!