Reset form 屬性

定義和用法
form 屬性可返回對包含該重置按鈕的表單的引用。
若成功,該屬性返回一個表單對象。
語法
resetObject.form
流覽器支持
所有主要流覽器都支持 form 屬性
實例
實例
顯示重置按鈕所屬表單的 id:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<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()">顯示所屬的表單ID</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>IT研修(xuhuhu.com)</title>
<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()">顯示所屬的表單ID</button>
</body>
</html>
