自强学堂
自强学堂:学习、分享、让你更强!
JavaScript 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
 

HTML DOM Reset form 属性

Reset 对象参考手册 Reset 对象

定义和用法

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

若成功,该属性返回一个表单对象。

语法

resetObject.form


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


实例

实例

Display the id of the form containing the Reset button:

<html>
<head>
<script>
function displayResult()
{
var x=document.getElementById("reset1").form.id;
alert(x);
}
</script>
</head>
<body>

<form id="form1">
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>

<button type="button" onclick="displayResult()">Display id of container form</button>

</body>
</html>

尝试一下 »


Reset 对象参考手册 Reset 对象